Index: cmake/config-ix.cmake =================================================================== --- cmake/config-ix.cmake +++ cmake/config-ix.cmake @@ -457,13 +457,6 @@ if(LLVM_ENABLE_DIA_SDK AND NOT HAVE_DIA_SDK) message(FATAL_ERROR "DIA SDK not found. If you have both VS 2012 and 2013 installed, you may need to uninstall the former and re-install the latter afterwards.") endif() - - # Normalize to 0/1 for lit.site.cfg - if(LLVM_ENABLE_DIA_SDK) - set(LLVM_ENABLE_DIA_SDK 1) - else() - set(LLVM_ENABLE_DIA_SDK 0) - endif() else() set(LLVM_ENABLE_DIA_SDK 0) endif( MSVC ) Index: cmake/modules/AddLLVM.cmake =================================================================== --- cmake/modules/AddLLVM.cmake +++ cmake/modules/AddLLVM.cmake @@ -1063,6 +1063,19 @@ endif() endfunction() +# This function canonicalize the CMake variables passed by names +# from CMake boolean to 0/1 suitable for passing into Python or C++, +# in place. +function(llvm_canonicalize_cmake_booleans) + foreach(var ${ARGN}) + if(${var}) + set(${var} 1 PARENT_SCOPE) + else() + set(${var} 0 PARENT_SCOPE) + endif() + endforeach() +endfunction(llvm_canonicalize_cmake_booleans) + # This function provides an automatic way to 'configure'-like generate a file # based on a set of common and custom variables, specifically targeting the # variables needed for the 'lit.site.cfg' files. This function bundles the Index: test/Bindings/Go/lit.local.cfg =================================================================== --- test/Bindings/Go/lit.local.cfg +++ test/Bindings/Go/lit.local.cfg @@ -6,7 +6,7 @@ if not 'go' in config.root.llvm_bindings: config.unsupported = True -if config.root.include_go_tests != 'ON': +if not config.root.include_go_tests: config.unsupported = True def find_executable(executable, path=None): Index: test/Bindings/OCaml/lit.local.cfg =================================================================== --- test/Bindings/OCaml/lit.local.cfg +++ test/Bindings/OCaml/lit.local.cfg @@ -3,5 +3,5 @@ if not 'ocaml' in config.root.llvm_bindings: config.unsupported = True -if config.root.have_ocaml_ounit not in ('1', 'TRUE'): +if not config.root.have_ocaml_ounit: config.unsupported = True Index: test/CMakeLists.txt =================================================================== --- test/CMakeLists.txt +++ test/CMakeLists.txt @@ -1,3 +1,14 @@ +llvm_canonicalize_cmake_booleans( + LLVM_TOOL_LTO_BUILD + HAVE_OCAMLOPT + HAVE_OCAML_OUNIT + LLVM_INCLUDE_GO_TESTS + LLVM_USE_INTEL_JITEVENTS + HAVE_LIBZ + HAVE_LIBXAR + LLVM_ENABLE_DIA_SDK + LLVM_ENABLE_FFI) + configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg Index: test/ExecutionEngine/Interpreter/lit.local.cfg =================================================================== --- test/ExecutionEngine/Interpreter/lit.local.cfg +++ test/ExecutionEngine/Interpreter/lit.local.cfg @@ -1,3 +1,3 @@ # These tests require foreign function calls -if config.enable_ffi != "ON": +if not config.enable_ffi: config.unsupported = True Index: test/JitListener/lit.local.cfg =================================================================== --- test/JitListener/lit.local.cfg +++ test/JitListener/lit.local.cfg @@ -1,3 +1,3 @@ -if not config.root.llvm_use_intel_jitevents == "true": +if not config.root.llvm_use_intel_jitevents: config.unsupported = True Index: test/lit.cfg =================================================================== --- test/lit.cfg +++ test/lit.cfg @@ -231,7 +231,7 @@ config.substitutions.append( ('%ocamlc', "%s ocamlc -cclib -L%s %s" % (config.ocamlfind_executable, llvm_lib_dir, config.ocaml_flags)) ) -if config.have_ocamlopt in ('1', 'TRUE'): +if config.have_ocamlopt: config.substitutions.append( ('%ocamlopt', "%s ocamlopt -cclib -L%s -cclib -Wl,-rpath,%s %s" % (config.ocamlfind_executable, llvm_lib_dir, llvm_lib_dir, config.ocaml_flags)) ) @@ -399,7 +399,7 @@ if not 'hexagon' in config.target_triple: config.available_features.add("object-emission") -if config.have_zlib == "1": +if config.have_zlib: config.available_features.add("zlib") else: config.available_features.add("nozlib") @@ -455,7 +455,7 @@ config.available_features.add('ld_plugin') def have_ld64_plugin_support(): - if (config.llvm_tool_lto_build == 'OFF' or config.ld64_executable == ''): + if not config.llvm_tool_lto_build or config.ld64_executable == '': return False ld_cmd = subprocess.Popen([config.ld64_executable, '-v'], stderr = subprocess.PIPE) Index: test/lit.site.cfg.in =================================================================== --- test/lit.site.cfg.in +++ test/lit.site.cfg.in @@ -15,12 +15,12 @@ config.python_executable = "@PYTHON_EXECUTABLE@" config.gold_executable = "@GOLD_EXECUTABLE@" config.ld64_executable = "@LD64_EXECUTABLE@" -config.llvm_tool_lto_build = "@LLVM_TOOL_LTO_BUILD@" +config.llvm_tool_lto_build = @LLVM_TOOL_LTO_BUILD@ config.ocamlfind_executable = "@OCAMLFIND@" -config.have_ocamlopt = "@HAVE_OCAMLOPT@" -config.have_ocaml_ounit = "@HAVE_OCAML_OUNIT@" +config.have_ocamlopt = @HAVE_OCAMLOPT@ +config.have_ocaml_ounit = @HAVE_OCAML_OUNIT@ config.ocaml_flags = "@OCAMLFLAGS@" -config.include_go_tests = "@LLVM_INCLUDE_GO_TESTS@" +config.include_go_tests = @LLVM_INCLUDE_GO_TESTS@ config.go_executable = "@GO_EXECUTABLE@" config.enable_shared = @ENABLE_SHARED@ config.enable_assertions = @ENABLE_ASSERTIONS@ @@ -32,12 +32,12 @@ config.host_cc = "@HOST_CC@" config.host_cxx = "@HOST_CXX@" config.host_ldflags = "@HOST_LDFLAGS@" -config.llvm_use_intel_jitevents = "@LLVM_USE_INTEL_JITEVENTS@" +config.llvm_use_intel_jitevents = @LLVM_USE_INTEL_JITEVENTS@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" -config.have_zlib = "@HAVE_LIBZ@" -config.have_libxar = "@HAVE_LIBXAR@" +config.have_zlib = @HAVE_LIBZ@ +config.have_libxar = @HAVE_LIBXAR@ config.have_dia_sdk = @LLVM_ENABLE_DIA_SDK@ -config.enable_ffi = "@LLVM_ENABLE_FFI@" +config.enable_ffi = @LLVM_ENABLE_FFI@ # Support substitution of the tools_dir with user parameters. This is # used when we can't determine the tool dir at configuration time.