summaryrefslogtreecommitdiffstats
path: root/Tests/ComplexOneConfig
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-01-25 13:38:06 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-01-25 13:38:06 (GMT)
commit07ef88c985a66cec5126930dbc3cfd736072183e (patch)
treecc9834e4f1f898845408fa21c006d4f9c391b318 /Tests/ComplexOneConfig
parent008406a96c66afaa6a3e1105c730cffd1b1e8bc8 (diff)
downloadCMake-07ef88c985a66cec5126930dbc3cfd736072183e.zip
CMake-07ef88c985a66cec5126930dbc3cfd736072183e.tar.gz
CMake-07ef88c985a66cec5126930dbc3cfd736072183e.tar.bz2
ENH: add COMPILE_FLAGS to targets
Diffstat (limited to 'Tests/ComplexOneConfig')
-rw-r--r--Tests/ComplexOneConfig/Executable/CMakeLists.txt2
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx20
-rw-r--r--Tests/ComplexOneConfig/Executable/testcflags.c11
3 files changed, 29 insertions, 4 deletions
diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
index 0f5add9..768e0fa 100644
--- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
@@ -56,7 +56,7 @@ SET_SOURCE_FILES_PROPERTIES(complex
COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS"
OBJECT_DEPENDS ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
)
-
+SET_TARGET_PROPERTIES(complex PROPERTIES COMPILE_FLAGS "-DCOMPLEX_TARGET_FLAG")
ADD_CUSTOM_COMMAND(
TARGET complex
SOURCE ${Complex_SOURCE_DIR}/cmTestGeneratedHeader.h.in
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index 06af8ec..f7f8d53 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -272,6 +272,7 @@ void ForceStringUse()
// defined in testcflags.c
extern "C" int TestCFlags(char* m);
+extern "C" int TestTargetCompileFlags(char* m);
// ======================================================================
@@ -387,7 +388,12 @@ int main()
{
cmPassed("Call to file1 function returned 1.");
}
-
+#ifndef COMPLEX_TARGET_FLAG
+ cmFailed("COMPILE_FLAGS did not work with SET_TARGET_PROPERTIES");
+#else
+ cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES");
+#endif
+
if(file2() != 1)
{
cmFailed("Call to file2 function from library failed.");
@@ -403,6 +409,7 @@ int main()
#endif
std::string gen = CMAKE_GENERATOR;
// visual studio is currently broken for c flags
+ char msg[1024];
if(gen.find("Visual") == gen.npos)
{
#ifdef TEST_C_FLAGS
@@ -410,7 +417,6 @@ int main()
#else
cmPassed("CMake CMAKE_C_FLAGS are not being passed to c++ files.");
#endif
- char msg[1024];
if(TestCFlags(msg))
{
cmPassed(
@@ -421,7 +427,15 @@ int main()
cmFailed(msg);
}
}
-
+ if(TestTargetCompileFlags(msg))
+ {
+ cmPassed(msg);
+ }
+ else
+ {
+ cmFailed(msg);
+ }
+
// ----------------------------------------------------------------------
// Test ADD_DEFINITIONS
diff --git a/Tests/ComplexOneConfig/Executable/testcflags.c b/Tests/ComplexOneConfig/Executable/testcflags.c
index 6c692f3..f4d5848 100644
--- a/Tests/ComplexOneConfig/Executable/testcflags.c
+++ b/Tests/ComplexOneConfig/Executable/testcflags.c
@@ -1,4 +1,15 @@
#include <string.h>
+
+int TestTargetCompileFlags(char* m)
+{
+#ifndef COMPLEX_TARGET_FLAG
+ strcpy(m, "CMAKE SET_TARGET_PROPERTIES COMPILE_FLAGS did not work");
+ return 0;
+#endif
+ strcpy(m, "CMAKE SET_TARGET_PROPERTIES COMPILE_FLAGS worked");
+ return 1;
+}
+
int TestCFlags(char* m)
{
/* TEST_CXX_FLAGS should not be defined in a c file */