summaryrefslogtreecommitdiff
path: root/Tests/CompileDefinitions
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-05-16 15:52:25 +0200
committerBrad King <brad.king@kitware.com>2013-05-24 09:06:53 -0400
commit32410140a7c592090249db772fd5f18c7808a3aa (patch)
tree055e13759b3d6a1a7d67311c3f0fcb609c5adcdb /Tests/CompileDefinitions
parenta7ba4520c7b15dc9f56d2c4718748b79b12c0c89 (diff)
downloadcmake-32410140a7c592090249db772fd5f18c7808a3aa.tar.gz
Add $<LINK_LANGUAGE> generator expression
They can't be used when evaluating link libraries, but they can be used for include directories and compile definitions. Later they can be used for compile options.
Diffstat (limited to 'Tests/CompileDefinitions')
-rw-r--r--Tests/CompileDefinitions/compiletest.c19
-rw-r--r--Tests/CompileDefinitions/compiletest.cpp15
-rw-r--r--Tests/CompileDefinitions/compiletest_mixed_c.c19
-rw-r--r--Tests/CompileDefinitions/compiletest_mixed_cxx.cpp19
-rw-r--r--Tests/CompileDefinitions/target_prop/CMakeLists.txt20
5 files changed, 92 insertions, 0 deletions
diff --git a/Tests/CompileDefinitions/compiletest.c b/Tests/CompileDefinitions/compiletest.c
new file mode 100644
index 0000000000..d7883af77d
--- /dev/null
+++ b/Tests/CompileDefinitions/compiletest.c
@@ -0,0 +1,19 @@
+
+#ifndef LINK_C_DEFINE
+#error Expected LINK_C_DEFINE
+#endif
+#ifndef LINK_LANGUAGE_IS_C
+#error Expected LINK_LANGUAGE_IS_C
+#endif
+
+#ifdef LINK_CXX_DEFINE
+#error Unexpected LINK_CXX_DEFINE
+#endif
+#ifdef LINK_LANGUAGE_IS_CXX
+#error Unexpected LINK_LANGUAGE_IS_CXX
+#endif
+
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/CompileDefinitions/compiletest.cpp b/Tests/CompileDefinitions/compiletest.cpp
index 7379380dec..7df09df819 100644
--- a/Tests/CompileDefinitions/compiletest.cpp
+++ b/Tests/CompileDefinitions/compiletest.cpp
@@ -56,6 +56,21 @@ enum {
#error Expect PREFIX_DEF2
#endif
+#ifndef LINK_CXX_DEFINE
+#error Expected LINK_CXX_DEFINE
+#endif
+#ifndef LINK_LANGUAGE_IS_CXX
+#error Expected LINK_LANGUAGE_IS_CXX
+#endif
+
+#ifdef LINK_C_DEFINE
+#error Unexpected LINK_C_DEFINE
+#endif
+#ifdef LINK_LANGUAGE_IS_C
+#error Unexpected LINK_LANGUAGE_IS_C
+#endif
+
+
// TEST_GENERATOR_EXPRESSIONS
#endif
diff --git a/Tests/CompileDefinitions/compiletest_mixed_c.c b/Tests/CompileDefinitions/compiletest_mixed_c.c
new file mode 100644
index 0000000000..698c989a81
--- /dev/null
+++ b/Tests/CompileDefinitions/compiletest_mixed_c.c
@@ -0,0 +1,19 @@
+
+#ifndef LINK_CXX_DEFINE
+#error Expected LINK_CXX_DEFINE
+#endif
+#ifndef LINK_LANGUAGE_IS_CXX
+#error Expected LINK_LANGUAGE_IS_CXX
+#endif
+
+#ifdef LINK_C_DEFINE
+#error Unexpected LINK_C_DEFINE
+#endif
+#ifdef LINK_LANGUAGE_IS_C
+#error Unexpected LINK_LANGUAGE_IS_C
+#endif
+
+void someFunc(void)
+{
+
+}
diff --git a/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp b/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp
new file mode 100644
index 0000000000..c6868547de
--- /dev/null
+++ b/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp
@@ -0,0 +1,19 @@
+
+#ifndef LINK_CXX_DEFINE
+#error Expected LINK_CXX_DEFINE
+#endif
+#ifndef LINK_LANGUAGE_IS_CXX
+#error Expected LINK_LANGUAGE_IS_CXX
+#endif
+
+#ifdef LINK_C_DEFINE
+#error Unexpected LINK_C_DEFINE
+#endif
+#ifdef LINK_LANGUAGE_IS_C
+#error Unexpected LINK_LANGUAGE_IS_C
+#endif
+
+int main(int argc, char **argv)
+{
+ return 0;
+}
diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt
index 34be91779c..66a3aa65e4 100644
--- a/Tests/CompileDefinitions/target_prop/CMakeLists.txt
+++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt
@@ -19,9 +19,29 @@ set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS
LETTER_LIST3=\"$<JOIN:A;B;C;D,,->\"
LETTER_LIST4=\"$<JOIN:A;B;C;D,-,->\"
LETTER_LIST5=\"$<JOIN:A;B;C;D,-,>\"
+ "$<$<LINK_LANGUAGE:CXX>:LINK_CXX_DEFINE>"
+ "$<$<LINK_LANGUAGE:C>:LINK_C_DEFINE>"
+ "LINK_LANGUAGE_IS_$<LINK_LANGUAGE>"
)
set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS
BUILD_IS_DEBUG=$<CONFIG:Debug>
BUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>
)
+
+add_executable(target_prop_c_executable ../compiletest.c)
+
+set_property(TARGET target_prop_c_executable APPEND PROPERTY COMPILE_DEFINITIONS
+ "$<$<LINK_LANGUAGE:CXX>:LINK_CXX_DEFINE>"
+ "$<$<LINK_LANGUAGE:C>:LINK_C_DEFINE>"
+ "LINK_LANGUAGE_IS_$<LINK_LANGUAGE>"
+ )
+
+# Resulting link language will be CXX
+add_executable(target_prop_mixed_executable ../compiletest_mixed_c.c ../compiletest_mixed_cxx.cpp)
+
+set_property(TARGET target_prop_mixed_executable APPEND PROPERTY COMPILE_DEFINITIONS
+ "$<$<LINK_LANGUAGE:CXX>:LINK_CXX_DEFINE>"
+ "$<$<LINK_LANGUAGE:C>:LINK_C_DEFINE>"
+ "LINK_LANGUAGE_IS_$<LINK_LANGUAGE>"
+ )