summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-config/CMakeLists.txt
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2017-01-10 19:55:51 +0000
committerMichal Gorny <mgorny@gentoo.org>2017-01-10 19:55:51 +0000
commit6911324ed4e6263335e94c8635ac62e7663666fb (patch)
treeae440bb2e773cfee2bed6cacf755da89444a3490 /llvm/tools/llvm-config/CMakeLists.txt
parent1612f8c4208f8f7d235125c54fe27dc2b1dbc2e1 (diff)
downloadbcm5719-llvm-6911324ed4e6263335e94c8635ac62e7663666fb.tar.gz
bcm5719-llvm-6911324ed4e6263335e94c8635ac62e7663666fb.zip
[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
Diffstat (limited to 'llvm/tools/llvm-config/CMakeLists.txt')
-rw-r--r--llvm/tools/llvm-config/CMakeLists.txt11
1 files changed, 6 insertions, 5 deletions
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).
OpenPOWER on IntegriCloud