summaryrefslogtreecommitdiffstats
path: root/Tests/CompileDefinitions/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-03-25 13:43:22 (GMT)
committerBrad King <brad.king@kitware.com>2013-03-25 14:49:42 (GMT)
commit1703b00c7fc34f473e84f4ba29bdc73476637005 (patch)
treed32cb8e0ef24144e0ee7c904884cbd8adebc78d5 /Tests/CompileDefinitions/CMakeLists.txt
parenta6286e92c9be9f5b8ad8fb25b3c6e15c0ec17fa0 (diff)
downloadCMake-1703b00c7fc34f473e84f4ba29bdc73476637005.zip
CMake-1703b00c7fc34f473e84f4ba29bdc73476637005.tar.gz
CMake-1703b00c7fc34f473e84f4ba29bdc73476637005.tar.bz2
Test evaluation of per-config COMPILE_DEFINITIONS (#14037)
Teach the CompileDefinitions test to cover evaluation of config-specific generator expressions.
Diffstat (limited to 'Tests/CompileDefinitions/CMakeLists.txt')
-rw-r--r--Tests/CompileDefinitions/CMakeLists.txt15
1 files changed, 12 insertions, 3 deletions
diff --git a/Tests/CompileDefinitions/CMakeLists.txt b/Tests/CompileDefinitions/CMakeLists.txt
index e7d91bf..d3e9a3e 100644
--- a/Tests/CompileDefinitions/CMakeLists.txt
+++ b/Tests/CompileDefinitions/CMakeLists.txt
@@ -7,10 +7,19 @@ if ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 6")
add_definitions(-DNO_SPACES_IN_DEFINE_VALUES)
endif()
+# Use compile flags to tell executables which config is built
+# without depending on the compile definitions functionality.
+foreach(c DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
+ set(CMAKE_C_FLAGS_${c} "${CMAKE_C_FLAGS_${c}} -DTEST_CONFIG_${c}")
+ set(CMAKE_CXX_FLAGS_${c} "${CMAKE_CXX_FLAGS_${c}} -DTEST_CONFIG_${c}")
+endforeach()
+
+set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
+ "BUILD_CONFIG_NAME=\"$<CONFIGURATION>\""
+ )
+
add_subdirectory(add_definitions_command)
add_subdirectory(target_prop)
add_subdirectory(add_definitions_command_with_target_prop)
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummyexecutable.cpp" "int main(int, char **) { return 0; }\n")
-
-add_executable(CompileDefinitions "${CMAKE_CURRENT_BINARY_DIR}/dummyexecutable.cpp")
+add_executable(CompileDefinitions runtest.c)