summaryrefslogtreecommitdiffstats
path: root/Tests/Preprocess
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-18 00:29:43 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-18 00:29:43 (GMT)
commit433099ecddb334cc6e43c6302594d7c713ef4d1e (patch)
tree65b1ec804f8e0e40c5b0c7083cbf6e0913572b55 /Tests/Preprocess
parentcaca9b80652c7c36ed1e39e1faeec64e3397f632 (diff)
downloadCMake-433099ecddb334cc6e43c6302594d7c713ef4d1e.zip
CMake-433099ecddb334cc6e43c6302594d7c713ef4d1e.tar.gz
CMake-433099ecddb334cc6e43c6302594d7c713ef4d1e.tar.bz2
ENH: Converted cmMakefile DefineFlags added by ADD_DEFINITIONS command into a COMPILE_DEFINITIONS directory property.
Diffstat (limited to 'Tests/Preprocess')
-rw-r--r--Tests/Preprocess/CMakeLists.txt15
-rw-r--r--Tests/Preprocess/preprocess.c30
-rw-r--r--Tests/Preprocess/preprocess.cxx30
3 files changed, 75 insertions, 0 deletions
diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt
index 58bddbd..ee2e355 100644
--- a/Tests/Preprocess/CMakeLists.txt
+++ b/Tests/Preprocess/CMakeLists.txt
@@ -144,6 +144,17 @@ endif("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6")
# Test old-style definitions.
add_definitions(-DOLD_DEF -DOLD_EXPR=2)
+# Make sure old-style definitions are converted to directory property.
+if(PREPROCESS_VS6)
+ set(OLD_DEFS_EXPECTED "OLD_DEF")
+else(PREPROCESS_VS6)
+ set(OLD_DEFS_EXPECTED "OLD_DEF;OLD_EXPR=2")
+endif(PREPROCESS_VS6)
+get_property(OLD_DEFS DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+if(NOT "${OLD_DEFS}" STREQUAL "${OLD_DEFS_EXPECTED}")
+ message(SEND_ERROR "add_definitions not converted to directory property!")
+endif(NOT "${OLD_DEFS}" STREQUAL "${OLD_DEFS_EXPECTED}")
+
add_executable(Preprocess preprocess.c preprocess${VS6}.cxx)
set(FILE_PATH "${Preprocess_SOURCE_DIR}/file_def.h")
@@ -152,6 +163,10 @@ set(TARGET_PATH "${Preprocess_SOURCE_DIR}/target_def.h")
# Set some definition properties.
foreach(c "" "_DEBUG" "_RELEASE")
set_property(
+ DIRECTORY .
+ APPEND PROPERTY COMPILE_DEFINITIONS${c} "DIRECTORY_DEF${c}"
+ )
+ set_property(
TARGET Preprocess
PROPERTY COMPILE_DEFINITIONS${c} "TARGET_DEF${c}"
)
diff --git a/Tests/Preprocess/preprocess.c b/Tests/Preprocess/preprocess.c
index baa18df..5dd9003 100644
--- a/Tests/Preprocess/preprocess.c
+++ b/Tests/Preprocess/preprocess.c
@@ -52,6 +52,12 @@ int check_defines_C(void)
result = 0;
}
# endif
+# ifdef DIRECTORY_DEF_DEBUG
+ {
+ fprintf(stderr, "DIRECTORY_DEF_DEBUG should not be defined in C\n");
+ result = 0;
+ }
+# endif
# ifndef FILE_DEF_RELEASE
# ifndef PREPROCESS_XCODE
{
@@ -66,6 +72,12 @@ int check_defines_C(void)
result = 0;
}
# endif
+# ifndef DIRECTORY_DEF_RELEASE
+ {
+ fprintf(stderr, "DIRECTORY_DEF_RELEASE should be defined in C\n");
+ result = 0;
+ }
+# endif
#endif
#ifdef PREPROCESS_DEBUG
# ifndef FILE_DEF_DEBUG
@@ -82,6 +94,12 @@ int check_defines_C(void)
result = 0;
}
# endif
+# ifndef DIRECTORY_DEF_DEBUG
+ {
+ fprintf(stderr, "DIRECTORY_DEF_DEBUG should be defined in C\n");
+ result = 0;
+ }
+# endif
# ifdef FILE_DEF_RELEASE
{
fprintf(stderr, "FILE_DEF_RELEASE should not be defined in C\n");
@@ -94,6 +112,12 @@ int check_defines_C(void)
result = 0;
}
# endif
+# ifdef DIRECTORY_DEF_RELEASE
+ {
+ fprintf(stderr, "DIRECTORY_DEF_RELEASE should not be defined in C\n");
+ result = 0;
+ }
+# endif
#endif
#if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
# if !defined(FILE_DEF_DEBUG) || !defined(TARGET_DEF_DEBUG)
@@ -153,6 +177,12 @@ int check_defines_C(void)
result = 0;
}
#endif
+#ifndef DIRECTORY_DEF
+ {
+ fprintf(stderr, "DIRECTORY_DEF not defined in C\n");
+ result = 0;
+ }
+#endif
#ifndef OLD_DEF
{
fprintf(stderr, "OLD_DEF not defined in C\n");
diff --git a/Tests/Preprocess/preprocess.cxx b/Tests/Preprocess/preprocess.cxx
index 07b7183..628521f 100644
--- a/Tests/Preprocess/preprocess.cxx
+++ b/Tests/Preprocess/preprocess.cxx
@@ -54,6 +54,12 @@ int check_defines_CXX()
result = 0;
}
# endif
+# ifdef DIRECTORY_DEF_DEBUG
+ {
+ fprintf(stderr, "DIRECTORY_DEF_DEBUG should not be defined in CXX\n");
+ result = 0;
+ }
+# endif
# ifndef FILE_DEF_RELEASE
# ifndef PREPROCESS_XCODE
{
@@ -68,6 +74,12 @@ int check_defines_CXX()
result = 0;
}
# endif
+# ifndef DIRECTORY_DEF_RELEASE
+ {
+ fprintf(stderr, "DIRECTORY_DEF_RELEASE should be defined in CXX\n");
+ result = 0;
+ }
+# endif
#endif
#ifdef PREPROCESS_DEBUG
# ifndef FILE_DEF_DEBUG
@@ -84,6 +96,12 @@ int check_defines_CXX()
result = 0;
}
# endif
+# ifndef DIRECTORY_DEF_DEBUG
+ {
+ fprintf(stderr, "DIRECTORY_DEF_DEBUG should be defined in CXX\n");
+ result = 0;
+ }
+# endif
# ifdef FILE_DEF_RELEASE
{
fprintf(stderr, "FILE_DEF_RELEASE should not be defined in CXX\n");
@@ -96,6 +114,12 @@ int check_defines_CXX()
result = 0;
}
# endif
+# ifdef DIRECTORY_DEF_RELEASE
+ {
+ fprintf(stderr, "DIRECTORY_DEF_RELEASE should not be defined in CXX\n");
+ result = 0;
+ }
+# endif
#endif
#if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
# if !defined(FILE_DEF_DEBUG) || !defined(TARGET_DEF_DEBUG)
@@ -155,6 +179,12 @@ int check_defines_CXX()
result = 0;
}
#endif
+#ifndef DIRECTORY_DEF
+ {
+ fprintf(stderr, "DIRECTORY_DEF not defined in CXX\n");
+ result = 0;
+ }
+#endif
#ifndef OLD_DEF
{
fprintf(stderr, "OLD_DEF not defined in CXX\n");