summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-25 15:29:27 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-25 15:29:46 (GMT)
commita95cbf389015ed71443921e5815369cff30349ee (patch)
tree08680feb23800f3f2570557e64974465fa9dbcb1 /Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared.cmake
parent4a0e68266b74479275ca62aca258ca876bc15fc4 (diff)
downloadCMake-a95cbf389015ed71443921e5815369cff30349ee.zip
CMake-a95cbf389015ed71443921e5815369cff30349ee.tar.gz
CMake-a95cbf389015ed71443921e5815369cff30349ee.tar.bz2
Tests: Shorten RunCMake.GenEx-* case names
Reduce the length of the longest path on disk needed by the tests.
Diffstat (limited to 'Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared.cmake')
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared.cmake37
1 files changed, 37 insertions, 0 deletions
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared.cmake
new file mode 100644
index 0000000..806f0b6
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/shared.cmake
@@ -0,0 +1,37 @@
+enable_language(C)
+
+add_executable(exe main.c)
+add_library(lib1 SHARED lib1.c)
+add_library(lib2 SHARED lib2.c)
+add_library(lib3 SHARED lib3.c)
+add_library(static STATIC static.c)
+add_library(imported SHARED IMPORTED)
+set_property(TARGET imported PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/imported.dll")
+set_property(TARGET imported PROPERTY IMPORTED_IMPLIB "${CMAKE_SOURCE_DIR}/imported.lib")
+add_library(imported2 SHARED IMPORTED)
+if(NOT WIN32 AND NOT CYGWIN)
+ set_property(TARGET imported2 PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/imported2.dll")
+endif()
+set_property(TARGET imported2 PROPERTY IMPORTED_IMPLIB "${CMAKE_SOURCE_DIR}/imported2.lib")
+
+target_link_libraries(exe PRIVATE lib1 static imported imported2)
+target_link_libraries(lib1 PRIVATE lib2)
+target_link_libraries(lib1 INTERFACE lib3)
+
+set(expected_dlls "")
+if(WIN32 OR CYGWIN)
+ set(expected_dlls
+ "$<TARGET_FILE:lib1>"
+ "$<TARGET_FILE:imported>"
+ "$<TARGET_FILE:lib3>"
+ "$<TARGET_FILE:lib2>"
+ )
+endif()
+
+set(content "check_genex(\"${expected_dlls}\" \"$<TARGET_RUNTIME_DLLS:exe>\")\n")
+set(condition)
+get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(multi_config)
+ set(condition CONDITION "$<CONFIG:Debug>")
+endif()
+file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/dlls.cmake" CONTENT "${content}" ${condition})