1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

build: only pass -UNDEBUG when compiling C/C++

This patch limits adding -UNDEBUG to C and C++ files so that projects
can include files compiled with compilers that don't recognize this
argument (Swift e.g.).

add_definitions does not expand generators, hence the change from
add_definitions to add_compile_options.

Patch by Evan Wilde!
This commit is contained in:
Saleem Abdulrasool 2020-02-02 10:49:03 -08:00
parent a6d07ff143
commit 9c8f7a2737

View File

@ -57,7 +57,10 @@ if( LLVM_ENABLE_ASSERTIONS )
# On non-Debug builds cmake automatically defines NDEBUG, so we
# explicitly undefine it:
if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
add_definitions( -UNDEBUG )
# NOTE: use `add_compile_options` rather than `add_definitions` since
# `add_definitions` does not support generator expressions.
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-UNDEBUG>)
# Also remove /D NDEBUG to avoid MSVC warnings about conflicting defines.
foreach (flags_var_to_scrub
CMAKE_CXX_FLAGS_RELEASE