summaryrefslogtreecommitdiffstats
path: root/Tests/CompileOptions
diff options
context:
space:
mode:
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>2021-07-18 09:49:41 (GMT)
committerBrad King <brad.king@kitware.com>2021-07-26 13:50:26 (GMT)
commit91968ca66845dd560bb27710488a62b2be91c8ff (patch)
tree2ca752f2057967498aec976a71c2845fafd74743 /Tests/CompileOptions
parent0079f24f453a872e65804ace594127955c6c114c (diff)
downloadCMake-91968ca66845dd560bb27710488a62b2be91c8ff.zip
CMake-91968ca66845dd560bb27710488a62b2be91c8ff.tar.gz
CMake-91968ca66845dd560bb27710488a62b2be91c8ff.tar.bz2
Tests/CompileOptions: allow CMAKE_BUILD_TYPE=None
In the same spirit of commit ce1cadd35a, (Tests/ConfigSources: fix for non main stream CMAKE_BUILD_TYPE, 2021-04-01). Allow distributions' check to pass seemlessly. Issue: #22470
Diffstat (limited to 'Tests/CompileOptions')
-rw-r--r--Tests/CompileOptions/CMakeLists.txt4
1 files changed, 4 insertions, 0 deletions
diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt
index 96bafea..1bedac0 100644
--- a/Tests/CompileOptions/CMakeLists.txt
+++ b/Tests/CompileOptions/CMakeLists.txt
@@ -65,6 +65,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|AppleClang|MSVC)$")
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -DFLAG_A=2 -DFLAG_C=1")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -DFLAG_A=2 -DFLAG_C=1")
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " -DFLAG_A=2 -DFLAG_C=1")
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" _xbuild_type)
+ if(NOT _xbuild_type MATCHES "^(DEBUG|RELEASE|RELWITHDEBINFO|MINSIZEREL)$")
+ string(APPEND CMAKE_CXX_FLAGS_${_xbuild_type} " -DFLAG_A=2 -DFLAG_C=1")
+ endif()
set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS "-DFLAG_B=2" "-DFLAG_C=2" "-DFLAG_D=1")
set_property(TARGET testlib APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "-DFLAG_D=2")
if(NOT CMAKE_GENERATOR MATCHES "^Visual Studio 9")