mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 06:09:52 -06:00
This aligns `find_library` with the documentation that states it can be called from script mode. This is done by infering the proper prefix and suffix values when `find_library` is called when the `CMAKE_FIND_LIBRARY*` are not set. This also means that `find_library` won't produce obscure error messages about unset definitions. Fixes: #22027
16 lines
441 B
CMake
16 lines
441 B
CMake
|
|
if(TEMP_DIR)
|
|
file(REMOVE_RECURSE "${TEMP_DIR}")
|
|
file(MAKE_DIRECTORY "${TEMP_DIR}")
|
|
file(MAKE_DIRECTORY "${TEMP_DIR}/lib")
|
|
file(WRITE "${TEMP_DIR}/lib/libcreated.a" "created")
|
|
endif()
|
|
|
|
set(CMAKE_FIND_DEBUG_MODE 1)
|
|
find_library(CREATED_LIBRARY NAMES library_no_exist)
|
|
|
|
set(CMAKE_PREFIX_PATH "${TEMP_DIR}")
|
|
find_library(CREATED_LIBRARY NAMES created)
|
|
message(STATUS "CREATED_LIBRARY='${CREATED_LIBRARY}'")
|
|
set(CMAKE_FIND_DEBUG_MODE 0)
|