diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2021-06-02 13:46:37 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2021-06-04 14:07:38 (GMT) |
commit | 0c3c6acaff7e59712bdfc6ef66292ccebe8c5bcb (patch) | |
tree | 11b52b405e15ae0b8ab2790a7a255fb8367ba7bc /Tests/RunCMake/install | |
parent | 4910132d8c94ac2c08fddd3fafc79585e7423362 (diff) | |
download | CMake-0c3c6acaff7e59712bdfc6ef66292ccebe8c5bcb.zip CMake-0c3c6acaff7e59712bdfc6ef66292ccebe8c5bcb.tar.gz CMake-0c3c6acaff7e59712bdfc6ef66292ccebe8c5bcb.tar.bz2 |
Tests: Add tests for new options
Diffstat (limited to 'Tests/RunCMake/install')
-rw-r--r-- | Tests/RunCMake/install/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/install/RuntimeDependencies-COMPONENTS.cmake | 39 |
2 files changed, 40 insertions, 0 deletions
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index e9a29c4..f79a3ea 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -186,6 +186,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$") run_cmake(TARGETS-RUNTIME_DEPENDENCIES-cross) unset(RunCMake_TEST_OPTIONS) run_cmake(TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict) + run_cmake(RuntimeDependencies-COMPONENTS) else() run_cmake(TARGETS-RUNTIME_DEPENDENCIES-unsupported) run_cmake(TARGETS-RUNTIME_DEPENDENCY_SET-unsupported) diff --git a/Tests/RunCMake/install/RuntimeDependencies-COMPONENTS.cmake b/Tests/RunCMake/install/RuntimeDependencies-COMPONENTS.cmake new file mode 100644 index 0000000..4727de3 --- /dev/null +++ b/Tests/RunCMake/install/RuntimeDependencies-COMPONENTS.cmake @@ -0,0 +1,39 @@ +enable_language(C) + +function(check_components value) + get_cmake_property(comp COMPONENTS) + if(NOT comp STREQUAL value) + message(FATAL_ERROR "Expected value of COMPONENTS:\n ${value}\nActual value of COMPONENTS:\n ${comp}") + endif() +endfunction() + +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + add_library(tgt MODULE obj1.c) +else() + add_executable(tgt main.c) +endif() + +install(TARGETS tgt + RUNTIME_DEPENDENCIES + RUNTIME DESTINATION bin COMPONENT bin1 + LIBRARY DESTINATION lib COMPONENT lib1 + FRAMEWORK DESTINATION fw COMPONENT fw1 + ) +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + check_components("bin1;fw1;lib1") +else() + check_components("bin1;lib1") +endif() + +install(RUNTIME_DEPENDENCY_SET deps + RUNTIME DESTINATION bin COMPONENT bin2 + LIBRARY DESTINATION lib COMPONENT lib2 + FRAMEWORK DESTINATION fw COMPONENT fw2 + ) +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + check_components("bin1;fw1;fw2;lib1;lib2") +elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + check_components("bin1;bin2;lib1") +elseif() + check_components("bin1;lib1;lib2") +endif() |