Andrew Morrow: The current CMake setup for libc++ incorrectly uses the variable

LLVM_ENABLE_ASSERTIONS instead of LIBCXX_ENABLE_ASSERTIONS when
figuring out what _DEBUG/NDEBUG defines to set. It also tries to test
the non-existent variable 'uppercase_CMAKE_BUILD_TYPE', which the top
level LLVM CMakeLists.txt sets up, but which the top level libc++
CMakeLists.txt currently does not. Changing the variable name tested
and creating the uppercase release name variable allows libc++ to
honor the LIBCXX_ENABLE_ASSERTIONS option correctly.

llvm-svn: 161308
This commit is contained in:
Howard Hinnant 2012-08-05 17:37:39 +00:00
parent 812005e562
commit 73984be057

View File

@ -119,7 +119,8 @@ if (NOT LIBCXX_ENABLE_RTTI)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti) append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
endif() endif()
# Assert # Assert
if (LLVM_ENABLE_ASSERTIONS) string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
if (LIBCXX_ENABLE_ASSERTIONS)
# MSVC doesn't like _DEBUG on release builds. See PR 4379. # MSVC doesn't like _DEBUG on release builds. See PR 4379.
if (NOT MSVC) if (NOT MSVC)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG) list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)