From 6911324ed4e6263335e94c8635ac62e7663666fb Mon Sep 17 00:00:00 2001 From: Michal Gorny Date: Tue, 10 Jan 2017 19:55:51 +0000 Subject: [llvm-config] Canonicalize CMake booleans to 0/1 Following the similar change to lit configuration, ensure that all CMake booleans are canonicalized to 0/1 when being passed to llvm-config. This fixes the incorrect interpretation of values when user passes another value than the ON/OFF, and simplifies the code by removing unnecessary string matching. Furthermore, the code for --has-rtti and --has-global-isel has been modified to print consistent values indepdently of the boolean used by passed by the user to CMake. Sadly, the code already implicitly used different values for the two (YES/NO for --has-rtti, ON/OFF for --has-global-isel). Include tests for all booleans and multi-value options in llvm-config. Differential Revision: https://reviews.llvm.org/D28366 llvm-svn: 291593 --- llvm/tools/llvm-config/CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'llvm/tools/llvm-config/CMakeLists.txt') diff --git a/llvm/tools/llvm-config/CMakeLists.txt b/llvm/tools/llvm-config/CMakeLists.txt index 1f5db59beb5..5112648ea73 100644 --- a/llvm/tools/llvm-config/CMakeLists.txt +++ b/llvm/tools/llvm-config/CMakeLists.txt @@ -47,12 +47,13 @@ endif() set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}") set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE}) set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS}) -if(BUILD_SHARED_LIBS) - set(LLVM_ENABLE_SHARED ON) -else() - set(LLVM_ENABLE_SHARED OFF) -endif() string(REPLACE ";" " " LLVM_TARGETS_BUILT "${LLVM_TARGETS_TO_BUILD}") +llvm_canonicalize_cmake_booleans( + LLVM_BUILD_LLVM_DYLIB + LLVM_LINK_LLVM_DYLIB + LLVM_HAS_RTTI + LLVM_HAS_GLOBAL_ISEL + BUILD_SHARED_LIBS) configure_file(${BUILDVARIABLES_SRCPATH} ${BUILDVARIABLES_OBJPATH} @ONLY) # Set build-time environment(s). -- cgit v1.2.3