aboutsummaryrefslogtreecommitdiff
path: root/test cases/cmake
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2021-12-18 14:04:08 +0100
committerDaniel Mensinger <daniel@mensinger-ka.de>2022-01-23 13:22:59 +0100
commit42843c4cf6d8e9013ebbf0f77dea7b33bb1ff328 (patch)
tree49be850bac008cd0a488e7f19956857a2a1a8d4f /test cases/cmake
parent99aae9b4dfc7f1ab6469adee718d54d9afd45097 (diff)
downloadmeson-42843c4cf6d8e9013ebbf0f77dea7b33bb1ff328.zip
meson-42843c4cf6d8e9013ebbf0f77dea7b33bb1ff328.tar.gz
meson-42843c4cf6d8e9013ebbf0f77dea7b33bb1ff328.tar.bz2
cmake: Add TARGET_ generator expression support (fixes #9305)
Diffstat (limited to 'test cases/cmake')
-rw-r--r--test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt10
-rw-r--r--test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp32
2 files changed, 42 insertions, 0 deletions
diff --git a/test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt
index dc4f9e4..27b3721 100644
--- a/test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt
+++ b/test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt
@@ -12,6 +12,10 @@ target_compile_options(cmModLib
INTERFACE "-DCMAKE_FLAG_REQUIRED_A"
INTERFACE $<$<AND:1,$<STREQUAL:asd,$<LOWER_CASE:AsD>>,$<NOT:$<EQUAL:4,2>>>:-DCMAKE_FLAG_REQUIRED_B>
INTERFACE $<$<VERSION_LESS:1.2.3,2.1.0>:-DCMAKE_FLAG_REQUIRED_C>
+ INTERFACE $<IF:$<NOT:$<BOOL:OFF>>,-DCMAKE_TRUE_FLAG,-DCMAKE_FALSE_FLAG>
+ INTERFACE $<IF:$<TARGET_EXISTS:cmModLib>,-DCMAKE_TGT_EXISTS,-DCMAKE_TGT_NEXISTS>
+ INTERFACE $<IF:$<TARGET_PROPERTY:IMPORTED_NO_SONAME>,-DCMAKE_PROP1_OK,-DCMAKE_PROP1_ERROR>
+ INTERFACE $<IF:$<TARGET_PROPERTY:cmModLib,IMPORT_SUFFIX>,-DCMAKE_PROP2_ERROR,-DCMAKE_PROP2_OK>
)
target_include_directories(cmModLib INTERFACE
@@ -19,4 +23,10 @@ target_include_directories(cmModLib INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
+set_target_properties(cmModLib
+ PROPERTIES
+ IMPORTED_NO_SONAME 1
+ IMPORT_SUFFIX 0
+)
+
target_compile_definitions(cmModLib INTERFACE -DCMAKE_COMPILER_DEFINE_STR="compDef")
diff --git a/test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp b/test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp
index 1f00107..416e5bb 100644
--- a/test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp
+++ b/test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp
@@ -18,6 +18,38 @@
#error "The flag CMAKE_FLAG_ERROR_A was set"
#endif
+#ifndef CMAKE_TRUE_FLAG
+#error "The flag CMAKE_TRUE_FLAG was not set"
+#endif
+
+#ifdef CMAKE_FALSE_FLAG
+#error "The flag CMAKE_FALSE_FLAG was set"
+#endif
+
+#ifndef CMAKE_TGT_EXISTS
+#error "The flag CMAKE_TGT_EXISTS was not set"
+#endif
+
+#ifdef CMAKE_TGT_NEXISTS
+#error "The flag CMAKE_TGT_NEXISTS was set"
+#endif
+
+#ifndef CMAKE_PROP1_OK
+#error "The flag CMAKE_PROP1_OK was not set"
+#endif
+
+#ifdef CMAKE_PROP1_ERROR
+#error "The flag CMAKE_PROP1_ERROR was set"
+#endif
+
+#ifndef CMAKE_PROP2_OK
+#error "The flag CMAKE_PROP2_OK was not set"
+#endif
+
+#ifdef CMAKE_PROP2_ERROR
+#error "The flag CMAKE_PROP2_ERROR was set"
+#endif
+
class cmModClass {
private:
std::string str;