diff options
author | Brad King <brad.king@kitware.com> | 2020-06-30 11:25:46 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-06-30 11:25:53 (GMT) |
commit | e9f667c3b02711e295d41a6a328d002aa2122c09 (patch) | |
tree | ad0e9340f590c52af93a21d835087ba7fdc9e757 /Tests/RunCMake | |
parent | e23428c99f146699dbcc724c45837cd61bc13ae7 (diff) | |
parent | f2c903fb9a02b129c6673385363f2a99f2f153ce (diff) | |
download | CMake-e9f667c3b02711e295d41a6a328d002aa2122c09.zip CMake-e9f667c3b02711e295d41a6a328d002aa2122c09.tar.gz CMake-e9f667c3b02711e295d41a6a328d002aa2122c09.tar.bz2 |
Merge topic 'find_library-file-readable' into release-3.18
f2c903fb9a find_library: Check that library files are readable
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4945
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/find_library/LibSymLink-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/find_library/LibSymLink.cmake | 17 | ||||
-rw-r--r-- | Tests/RunCMake/find_library/RunCMakeTest.cmake | 3 |
4 files changed, 22 insertions, 2 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 6c634b5..830566e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -317,7 +317,7 @@ add_RunCMake_test(ctest_upload) add_RunCMake_test(ctest_fixtures) add_RunCMake_test(file) add_RunCMake_test(find_file) -add_RunCMake_test(find_library) +add_RunCMake_test(find_library -DCYGWIN=${CYGWIN}) add_RunCMake_test(find_package) add_RunCMake_test(find_path) add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) diff --git a/Tests/RunCMake/find_library/LibSymLink-stderr.txt b/Tests/RunCMake/find_library/LibSymLink-stderr.txt new file mode 100644 index 0000000..8a2f088 --- /dev/null +++ b/Tests/RunCMake/find_library/LibSymLink-stderr.txt @@ -0,0 +1,2 @@ +^SYMLINK_LIBRARY='SYMLINK_LIBRARY-NOTFOUND' +SYMLINK_LIBRARY='[^']*/Tests/RunCMake/find_library/LibSymLink-build/lib/libsymlink.a'$ diff --git a/Tests/RunCMake/find_library/LibSymLink.cmake b/Tests/RunCMake/find_library/LibSymLink.cmake new file mode 100644 index 0000000..8ee4b75 --- /dev/null +++ b/Tests/RunCMake/find_library/LibSymLink.cmake @@ -0,0 +1,17 @@ +list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib) +list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +file(CREATE_LINK "libsymlinked.a" "${CMAKE_CURRENT_BINARY_DIR}/lib/libsymlink.a" SYMBOLIC) +find_library(SYMLINK_LIBRARY + NAMES symlink + PATHS ${CMAKE_CURRENT_BINARY_DIR}/lib + NO_DEFAULT_PATH + ) +message("SYMLINK_LIBRARY='${SYMLINK_LIBRARY}'") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib/libsymlinked.a" "symlinked") +find_library(SYMLINK_LIBRARY + NAMES symlink + PATHS ${CMAKE_CURRENT_BINARY_DIR}/lib + NO_DEFAULT_PATH + ) +message("SYMLINK_LIBRARY='${SYMLINK_LIBRARY}'") diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake index b6aadce..c7d69e4 100644 --- a/Tests/RunCMake/find_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake @@ -3,8 +3,9 @@ include(RunCMake) run_cmake(Created) run_cmake(FromPrefixPath) run_cmake(FromPATHEnv) -if(CMAKE_HOST_UNIX) +if(UNIX AND NOT CYGWIN) run_cmake(LibArchLink) + run_cmake(LibSymLink) endif() run_cmake(PrefixInPATH) run_cmake(Required) |