summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/FetchContent_find_package/PreferFetchContent.cmake
blob: 4943f9e204e25f6c0292363dc350c129a53e693e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)

# Verify that find_package() version constraints are fully ignored by the
# default-generated config version file
find_package(AddedProject 1.2.3 EXACT REQUIRED)