summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-17 22:34:56 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-17 22:34:56 (GMT)
commita3e53fcfa2cbc6123a65be82d85a1587aabb163d (patch)
treeac98699d4de1b6a084bf78ad978b876de1e5a41e
parent669db35aa445cc67eef1ff53aced9602e253249e (diff)
downloadCMake-a3e53fcfa2cbc6123a65be82d85a1587aabb163d.zip
CMake-a3e53fcfa2cbc6123a65be82d85a1587aabb163d.tar.gz
CMake-a3e53fcfa2cbc6123a65be82d85a1587aabb163d.tar.bz2
ENH: Use new set_property signature to set COMPILE_DEFINITIONS properties in Preprocess test.
-rw-r--r--Tests/Preprocess/CMakeLists.txt36
1 files changed, 19 insertions, 17 deletions
diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt
index 2983c96..58bddbd 100644
--- a/Tests/Preprocess/CMakeLists.txt
+++ b/Tests/Preprocess/CMakeLists.txt
@@ -144,39 +144,41 @@ endif("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6")
# Test old-style definitions.
add_definitions(-DOLD_DEF -DOLD_EXPR=2)
+add_executable(Preprocess preprocess.c preprocess${VS6}.cxx)
+
set(FILE_PATH "${Preprocess_SOURCE_DIR}/file_def.h")
set(TARGET_PATH "${Preprocess_SOURCE_DIR}/target_def.h")
-# Create a list of definition property strings.
-set(TARGET_DEFS "TARGET_DEF")
-set(FILE_DEFS "FILE_DEF")
+# Set some definition properties.
+foreach(c "" "_DEBUG" "_RELEASE")
+ set_property(
+ TARGET Preprocess
+ PROPERTY COMPILE_DEFINITIONS${c} "TARGET_DEF${c}"
+ )
+ set_property(
+ SOURCE preprocess.c preprocess${VS6}.cxx
+ PROPERTY COMPILE_DEFINITIONS${c} "FILE_DEF${c}"
+ )
+endforeach(c)
# Add definitions with values. VS6 does not support this.
if(NOT PREPROCESS_VS6)
- list(APPEND TARGET_DEFS
+ set_property(
+ TARGET Preprocess
+ APPEND PROPERTY COMPILE_DEFINITIONS
"TARGET_STRING=\"${STRING_VALUE}${SEMICOLON}\""
"TARGET_EXPR=${EXPR}"
"TARGET_PATH=\"${TARGET_PATH}\""
)
- list(APPEND FILE_DEFS
+ set_property(
+ SOURCE preprocess.c preprocess${VS6}.cxx
+ APPEND PROPERTY COMPILE_DEFINITIONS
"FILE_STRING=\"${STRING_VALUE}${SEMICOLON}\""
"FILE_EXPR=${EXPR}"
"FILE_PATH=\"${FILE_PATH}\""
)
endif(NOT PREPROCESS_VS6)
-add_executable(Preprocess preprocess.c preprocess${VS6}.cxx)
-set_target_properties(Preprocess PROPERTIES
- COMPILE_DEFINITIONS "${TARGET_DEFS}"
- COMPILE_DEFINITIONS_DEBUG "TARGET_DEF_DEBUG"
- COMPILE_DEFINITIONS_RELEASE "TARGET_DEF_RELEASE"
- )
-set_source_files_properties(preprocess.c preprocess${VS6}.cxx PROPERTIES
- COMPILE_DEFINITIONS "${FILE_DEFS}"
- COMPILE_DEFINITIONS_DEBUG "FILE_DEF_DEBUG"
- COMPILE_DEFINITIONS_RELEASE "FILE_DEF_RELEASE"
- )
-
# Helper target for running test manually in build tree.
add_custom_target(drive COMMAND Preprocess)