mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
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
This commit is contained in:
@@ -433,7 +433,8 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
|
||||
#endif
|
||||
if (name.Regex.find(testName)) {
|
||||
this->TestPath = cmStrCat(path, origName);
|
||||
if (!cmSystemTools::FileIsDirectory(this->TestPath)) {
|
||||
// Make sure the path is readable and is not a directory.
|
||||
if (cmSystemTools::FileExists(this->TestPath, true)) {
|
||||
this->DebugLibraryFound(name.Raw, dir);
|
||||
|
||||
// This is a matching file. Check if it is better than the
|
||||
|
||||
@@ -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})
|
||||
|
||||
2
Tests/RunCMake/find_library/LibSymLink-stderr.txt
Normal file
2
Tests/RunCMake/find_library/LibSymLink-stderr.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
^SYMLINK_LIBRARY='SYMLINK_LIBRARY-NOTFOUND'
|
||||
SYMLINK_LIBRARY='[^']*/Tests/RunCMake/find_library/LibSymLink-build/lib/libsymlink.a'$
|
||||
17
Tests/RunCMake/find_library/LibSymLink.cmake
Normal file
17
Tests/RunCMake/find_library/LibSymLink.cmake
Normal file
@@ -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}'")
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user