Files
CMake/Tests/RunCMake/find_library/FromScriptMode.cmake
Robert Maynard aa3ab3eb92 find_library: Infer library prefix and suffix when in script mode
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
2021-07-19 12:55:18 -04:00

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)