mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-28 01:49:23 -05:00
29e31e2825
Allow FetchContent_MakeAvailable() to try a call to find_package() first, or redirect a find_package() call to FetchContent_MakeAvailable(). The user can set variables to control which of these are allowed or tried by default. Fixes: #21687
21 lines
593 B
CMake
21 lines
593 B
CMake
include(FetchContent)
|
|
|
|
FetchContent_Declare(
|
|
AddedProject
|
|
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/AddedProject
|
|
OVERRIDE_FIND_PACKAGE
|
|
)
|
|
|
|
# The default generated config package files are expected to include these when present
|
|
file(WRITE ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/AddedProjectExtra.cmake [[
|
|
message(STATUS "Uppercase extra file was read")
|
|
]]
|
|
)
|
|
file(WRITE ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/addedproject-extra.cmake [[
|
|
message(STATUS "Lowercase extra file was read")
|
|
]]
|
|
)
|
|
|
|
# This is expected to be re-routed to a FetchContent_MakeAvailable() call
|
|
find_package(AddedProject REQUIRED)
|