mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 06:40:48 -06:00
Refactoring in commit 6b85166920 (ENH: Refactor find_library search
logic, 2008-09-22, v2.8.0~1665) dropped a call to `FileExists` on the
path under the assumption that the presence of a file in a directory
listing means it exists. However, dropping that also dropped a check
that verifies the file is readable. Restore the `FileExists` call to
ensure that we only find readable libraries.
18 lines
616 B
CMake
18 lines
616 B
CMake
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}'")
|