mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-29 02:19:18 -05:00
204b8d9f4e
Teach the find_package, find_library, find_program, find_path, and find_file commands to print debug log messages when enabled by the `--debug-find` command-line option or `CMAKE_FIND_DEBUG_MODE` variable.
18 lines
596 B
CMake
18 lines
596 B
CMake
list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib)
|
|
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
|
|
|
set(ENV_PATH "$ENV{PATH}")
|
|
|
|
set(CMAKE_FIND_DEBUG_MODE 1)
|
|
set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist")
|
|
find_library(PrefixInPATH_LIBRARY NAMES PrefixInPATH)
|
|
set(CMAKE_FIND_DEBUG_MODE 0)
|
|
|
|
foreach(path "/does_not_exist" "" "/bin" "/sbin")
|
|
unset(PrefixInPATH_LIBRARY CACHE)
|
|
set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
|
|
find_library(PrefixInPATH_LIBRARY NAMES PrefixInPATH)
|
|
message(STATUS "PrefixInPATH_LIBRARY='${PrefixInPATH_LIBRARY}'")
|
|
endforeach()
|
|
set(ENV{PATH} "${ENV_PATH}")
|