summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt6
-rw-r--r--Tests/CMakeCommands/target_compile_definitions/consumer.cpp4
-rw-r--r--Tests/CMakeCommands/target_include_directories/CMakeLists.txt11
-rw-r--r--Tests/CMakeCommands/target_include_directories/consumer.cpp5
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked-result.txt1
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked-stderr.txt7
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked.cmake7
-rw-r--r--Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake1
8 files changed, 41 insertions, 1 deletions
diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
index 8a4437b..0bfcc1b 100644
--- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
@@ -16,9 +16,15 @@ add_executable(consumer
"${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp"
)
+add_library(linked UNKNOWN IMPORTED)
+set_property(TARGET linked PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS "MY_LINKED_DEFINE")
+
+
target_compile_definitions(consumer
PRIVATE $<TARGET_PROPERTY:target_compile_definitions,INTERFACE_COMPILE_DEFINITIONS>
$<$<TARGET_DEFINED:notdefined>:SHOULD_NOT_BE_DEFINED>
$<$<TARGET_DEFINED:target_compile_definitions>:SHOULD_BE_DEFINED>
+ $<LINKED:linked>
-DDASH_D_DEFINE
)
diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp
index 1a46aa5..c077593 100644
--- a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp
+++ b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp
@@ -23,4 +23,8 @@
#error Expected DASH_D_DEFINE
#endif
+#ifndef MY_LINKED_DEFINE
+#error Expected MY_LINKED_DEFINE
+#endif
+
int main() { return 0; }
diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt
index 7529283..a564918 100644
--- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt
@@ -17,6 +17,9 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/poison/common.h" "#error Should not be i
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cure")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cure/common.h" "#define CURE_DEFINE\n")
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/linkedinclude")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/linkedinclude/linkedinclude.h" "#define LINKEDINCLUDE_DEFINE\n")
+
add_executable(target_include_directories
"${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
)
@@ -42,7 +45,13 @@ add_executable(consumer
"${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp"
)
+add_library(linked UNKNOWN IMPORTED)
+set_property(TARGET linked PROPERTY
+ INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/linkedinclude")
+
target_include_directories(consumer
- PRIVATE $<TARGET_PROPERTY:target_include_directories,INTERFACE_INCLUDE_DIRECTORIES>
+ PRIVATE
+ $<TARGET_PROPERTY:target_include_directories,INTERFACE_INCLUDE_DIRECTORIES>
+ $<LINKED:linked>
relative_dir
)
diff --git a/Tests/CMakeCommands/target_include_directories/consumer.cpp b/Tests/CMakeCommands/target_include_directories/consumer.cpp
index 82b800a..ccffd9c 100644
--- a/Tests/CMakeCommands/target_include_directories/consumer.cpp
+++ b/Tests/CMakeCommands/target_include_directories/consumer.cpp
@@ -3,6 +3,7 @@
#include "publicinclude.h"
#include "interfaceinclude.h"
#include "relative_dir.h"
+#include "linkedinclude.h"
#ifdef PRIVATEINCLUDE_DEFINE
#error Unexpected PRIVATEINCLUDE_DEFINE
@@ -24,4 +25,8 @@
#error Expected RELATIVE_DIR_DEFINE
#endif
+#ifndef LINKEDINCLUDE_DEFINE
+#error Expected LINKEDINCLUDE_DEFINE
+#endif
+
int main() { return 0; }
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked-stderr.txt
new file mode 100644
index 0000000..4cd9cdd
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<LINKED:something>
+
+ \$<LINKED:...> may only be used in INCLUDE_DIRECTORIES and
+ COMPILE_DEFINITIONS properties.$
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked.cmake
new file mode 100644
index 0000000..542ea76
--- /dev/null
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadLinked.cmake
@@ -0,0 +1,7 @@
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
+ "int main(int, char **) { return 0; }\n")
+
+add_executable(TargetPropertyGeneratorExpressions
+ "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
+target_link_libraries(TargetPropertyGeneratorExpressions "$<LINKED:something>")
diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake
index 0ee3238..ea48f61 100644
--- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake
@@ -15,3 +15,4 @@ run_cmake(BadInvalidName5)
run_cmake(BadInvalidName6)
run_cmake(BadInvalidName7)
run_cmake(BadInvalidName8)
+run_cmake(BadLinked)