summaryrefslogtreecommitdiffstats
path: root/Tests/CompileDefinitions
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-07-18 10:58:48 (GMT)
committerBrad King <brad.king@kitware.com>2013-07-24 14:40:00 (GMT)
commit4f6bd7022bf670f9516c7b5e67c254d639425ab4 (patch)
tree710881681b38d86aa8801dabcce2895206c6f969 /Tests/CompileDefinitions
parentf82c751d7b3ee3907d780060985a36bdddcabad3 (diff)
downloadCMake-4f6bd7022bf670f9516c7b5e67c254d639425ab4.zip
CMake-4f6bd7022bf670f9516c7b5e67c254d639425ab4.tar.gz
CMake-4f6bd7022bf670f9516c7b5e67c254d639425ab4.tar.bz2
Remove the LINK_LANGUAGE generator expression.
It accepted an optional argument to test for equality, but no way to get the linker language of a particular target. TARGET_PROPERTY provides this flexibility and STREQUAL provides the necessary API for equality test. Extend the CompileDefinitions test to cover accessing the property of another target.
Diffstat (limited to 'Tests/CompileDefinitions')
-rw-r--r--Tests/CompileDefinitions/compiletest_mixed_c.c4
-rw-r--r--Tests/CompileDefinitions/compiletest_mixed_cxx.cpp4
-rw-r--r--Tests/CompileDefinitions/target_prop/CMakeLists.txt19
3 files changed, 18 insertions, 9 deletions
diff --git a/Tests/CompileDefinitions/compiletest_mixed_c.c b/Tests/CompileDefinitions/compiletest_mixed_c.c
index 698c989..a270b2b 100644
--- a/Tests/CompileDefinitions/compiletest_mixed_c.c
+++ b/Tests/CompileDefinitions/compiletest_mixed_c.c
@@ -13,6 +13,10 @@
#error Unexpected LINK_LANGUAGE_IS_C
#endif
+#ifndef C_EXECUTABLE_LINK_LANGUAGE_IS_C
+#error Expected C_EXECUTABLE_LINK_LANGUAGE_IS_C define
+#endif
+
void someFunc(void)
{
diff --git a/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp b/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp
index c686854..ae6befc 100644
--- a/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp
+++ b/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp
@@ -13,6 +13,10 @@
#error Unexpected LINK_LANGUAGE_IS_C
#endif
+#ifndef C_EXECUTABLE_LINK_LANGUAGE_IS_C
+#error Expected C_EXECUTABLE_LINK_LANGUAGE_IS_C define
+#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 6bf9c5c..a0d3f4e 100644
--- a/Tests/CompileDefinitions/target_prop/CMakeLists.txt
+++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt
@@ -23,9 +23,9 @@ 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>"
+ "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>"
+ "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>"
+ "LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>"
)
set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS
@@ -36,16 +36,17 @@ set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS
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>"
+ "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>"
+ "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>"
+ "LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_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>"
+ "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>"
+ "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>"
+ "LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>"
+ "C_EXECUTABLE_LINK_LANGUAGE_IS_$<TARGET_PROPERTY:target_prop_c_executable,LINKER_LANGUAGE>"
)