diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2018-04-18 19:47:48 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-05-03 12:08:42 (GMT) |
commit | edcb545a24ed2df83813a89a20bb2beefe0531c1 (patch) | |
tree | c872ba1b2176113f9a4e81d4649b4643e439bb62 /Tests/RunCMake/install | |
parent | 0212d7c7629bb1a866da4f6c69b780c6d43f26f3 (diff) | |
download | CMake-edcb545a24ed2df83813a89a20bb2beefe0531c1.zip CMake-edcb545a24ed2df83813a89a20bb2beefe0531c1.tar.gz CMake-edcb545a24ed2df83813a89a20bb2beefe0531c1.tar.bz2 |
install: add test for new NAMELINK_COMPONENT parameter
Diffstat (limited to 'Tests/RunCMake/install')
12 files changed, 278 insertions, 0 deletions
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 1a60f0c..f004ce9 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -21,6 +21,10 @@ function(run_install_test case) # Check explicit component. set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-exc) run_cmake_command(${case}-exc ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=exc -P cmake_install.cmake) + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-lib) + run_cmake_command(${case}-lib ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=lib -P cmake_install.cmake) + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-dev) + run_cmake_command(${case}-dev ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=dev -P cmake_install.cmake) endif() endfunction() @@ -59,6 +63,8 @@ run_cmake(EXPORT-OldIFace) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) +run_cmake(TARGETS-NAMELINK_COMPONENT-bad-all) +run_cmake(TARGETS-NAMELINK_COMPONENT-bad-exc) if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") run_install_test(FILES-TARGET_OBJECTS) @@ -67,3 +73,4 @@ endif() set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) run_install_test(TARGETS-EXCLUDE_FROM_ALL) +run_install_test(TARGETS-NAMELINK_COMPONENT) diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake new file mode 100644 index 0000000..bc9ebd1 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake @@ -0,0 +1,73 @@ +if(WIN32) + set(_check_files + [[lib]] + [[lib/(lib)?namelink-none\.dll]] + [[lib/(lib)?namelink-same\.dll]] + [[lib/(lib)?namelink-sep\.dll]] + [[lib/(lib)?namelink-skip\.dll]] + [[lib/(lib)?namelink-uns-dev\.dll]] + [[lib/(lib)?namelink-uns\.dll]] + ) +elseif(CYGWIN) + set(_check_files + [[lib]] + [[lib/cygnamelink-none\.dll]] + [[lib/cygnamelink-same-1\.dll]] + [[lib/cygnamelink-sep-1\.dll]] + [[lib/cygnamelink-skip-1\.dll]] + [[lib/cygnamelink-uns-1\.dll]] + [[lib/cygnamelink-uns-dev-1\.dll]] + ) +elseif(APPLE) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.dylib]] + [[lib/libnamelink-only\.dylib]] + [[lib/libnamelink-same\.1\.0\.dylib]] + [[lib/libnamelink-same\.1\.dylib]] + [[lib/libnamelink-same\.dylib]] + [[lib/libnamelink-sep\.1\.0\.dylib]] + [[lib/libnamelink-sep\.1\.dylib]] + [[lib/libnamelink-sep\.dylib]] + [[lib/libnamelink-skip\.1\.0\.dylib]] + [[lib/libnamelink-skip\.1\.dylib]] + [[lib/libnamelink-uns-dev\.1\.0\.dylib]] + [[lib/libnamelink-uns-dev\.1\.dylib]] + [[lib/libnamelink-uns-dev\.dylib]] + [[lib/libnamelink-uns\.1\.0\.dylib]] + [[lib/libnamelink-uns\.1\.dylib]] + [[lib/libnamelink-uns\.dylib]] + ) +elseif(NO_NAMELINK) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-sep\.so]] + [[lib/libnamelink-skip\.so]] + [[lib/libnamelink-uns-dev\.so]] + [[lib/libnamelink-uns\.so]] + ) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-only\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-same\.so\.1]] + [[lib/libnamelink-same\.so\.1\.0]] + [[lib/libnamelink-sep\.so]] + [[lib/libnamelink-sep\.so\.1]] + [[lib/libnamelink-sep\.so\.1\.0]] + [[lib/libnamelink-skip\.so\.1]] + [[lib/libnamelink-skip\.so\.1\.0]] + [[lib/libnamelink-uns-dev\.so]] + [[lib/libnamelink-uns-dev\.so\.1]] + [[lib/libnamelink-uns-dev\.so\.1\.0]] + [[lib/libnamelink-uns\.so]] + [[lib/libnamelink-uns\.so\.1]] + [[lib/libnamelink-uns\.so\.1\.0]] + ) +endif() + +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt new file mode 100644 index 0000000..187a826 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TARGETS-NAMELINK_COMPONENT-bad-all\.cmake:5 \(install\): + install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The + NAMELINK_COMPONENT option may be specified only following LIBRARY\. +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\)$ diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake new file mode 100644 index 0000000..701d093 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +add_library(namelink-lib empty.c) + +install(TARGETS namelink-lib + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev +) diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt new file mode 100644 index 0000000..d1002ba --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TARGETS-NAMELINK_COMPONENT-bad-exc\.cmake:5 \(install\): + install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The + NAMELINK_COMPONENT option may be specified only following LIBRARY\. +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\)$ diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake new file mode 100644 index 0000000..19c12d4 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +add_executable(namelink-exc main.c) + +install(TARGETS namelink-exc + RUNTIME + DESTINATION bin + COMPONENT exc + NAMELINK_COMPONENT dev +) diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake new file mode 100644 index 0000000..5396cdb --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake @@ -0,0 +1,11 @@ +if(WIN32 OR CYGWIN OR NO_NAMELINK) + set(_check_files) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-only\.(so|dylib)]] + [[lib/libnamelink-sep\.(so|dylib)]] + [[lib/libnamelink-uns-dev\.(so|dylib)]] + ) +endif() +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake new file mode 100644 index 0000000..3f6be68 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake @@ -0,0 +1,50 @@ +if(WIN32) + set(_check_files + [[lib]] + [[lib/(lib)?namelink-none\.dll]] + [[lib/(lib)?namelink-same\.dll]] + [[lib/(lib)?namelink-sep\.dll]] + [[lib/(lib)?namelink-skip\.dll]] + ) +elseif(CYGWIN) + set(_check_files + [[lib]] + [[lib/cygnamelink-none\.dll]] + [[lib/cygnamelink-same-1\.dll]] + [[lib/cygnamelink-sep-1\.dll]] + [[lib/cygnamelink-skip-1\.dll]] + ) +elseif(APPLE) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.dylib]] + [[lib/libnamelink-same\.1\.0\.dylib]] + [[lib/libnamelink-same\.1\.dylib]] + [[lib/libnamelink-same\.dylib]] + [[lib/libnamelink-sep\.1\.0\.dylib]] + [[lib/libnamelink-sep\.1\.dylib]] + [[lib/libnamelink-skip\.1\.0\.dylib]] + [[lib/libnamelink-skip\.1\.dylib]] + ) +elseif(NO_NAMELINK) + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-sep\.so]] + [[lib/libnamelink-skip\.so]] + ) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-none\.so]] + [[lib/libnamelink-same\.so]] + [[lib/libnamelink-same\.so\.1]] + [[lib/libnamelink-same\.so\.1\.0]] + [[lib/libnamelink-sep\.so\.1]] + [[lib/libnamelink-sep\.so\.1\.0]] + [[lib/libnamelink-skip\.so\.1]] + [[lib/libnamelink-skip\.so\.1\.0]] + ) +endif() +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake new file mode 100644 index 0000000..0033c88 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake @@ -0,0 +1,38 @@ +if(WIN32) + set(_check_files + [[lib]] + [[lib/(lib)?namelink-uns-dev\.dll]] + [[lib/(lib)?namelink-uns\.dll]] + ) +elseif(CYGWIN) + set(_check_files + [[lib]] + [[lib/cygnamelink-uns-1\.dll]] + [[lib/cygnamelink-uns-dev-1\.dll]] + ) +elseif(APPLE) + set(_check_files + [[lib]] + [[lib/libnamelink-uns-dev\.1\.0\.dylib]] + [[lib/libnamelink-uns-dev\.1\.dylib]] + [[lib/libnamelink-uns\.1\.0\.dylib]] + [[lib/libnamelink-uns\.1\.dylib]] + [[lib/libnamelink-uns\.dylib]] + ) +elseif(NO_NAMELINK) + set(_check_files + [[lib]] + [[lib/libnamelink-uns-dev\.so]] + [[lib/libnamelink-uns\.so]] + ) +else() + set(_check_files + [[lib]] + [[lib/libnamelink-uns-dev\.so\.1]] + [[lib/libnamelink-uns-dev\.so\.1\.0]] + [[lib/libnamelink-uns\.so]] + [[lib/libnamelink-uns\.so\.1]] + [[lib/libnamelink-uns\.so\.1\.0]] + ) +endif() +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake new file mode 100644 index 0000000..0e684e1 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake @@ -0,0 +1,68 @@ +enable_language(C) + +macro(add_versioned_library NAME) + add_library(${NAME} SHARED obj1.c) + set_target_properties(${NAME} PROPERTIES + VERSION 1.0 + SOVERSION 1 + ) +endmacro() + +add_versioned_library(namelink-sep) +add_versioned_library(namelink-same) +add_versioned_library(namelink-uns) +add_versioned_library(namelink-uns-dev) +add_versioned_library(namelink-only) +add_versioned_library(namelink-skip) +add_library(namelink-none SHARED obj1.c) + +install(TARGETS namelink-sep namelink-none + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev +) +install(TARGETS namelink-same + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib +) +install(TARGETS namelink-uns + RUNTIME + DESTINATION lib + LIBRARY + DESTINATION lib +) +install(TARGETS namelink-uns-dev + RUNTIME + DESTINATION lib + LIBRARY + DESTINATION lib + NAMELINK_COMPONENT dev +) +install(TARGETS namelink-only + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev + NAMELINK_ONLY +) +install(TARGETS namelink-skip + RUNTIME + DESTINATION lib + COMPONENT lib + LIBRARY + DESTINATION lib + COMPONENT lib + NAMELINK_COMPONENT dev + NAMELINK_SKIP +) |