cmake/Tests/RunCMake/FetchContent/MakeAvailable.cmake

30 lines
844 B
CMake
Raw Normal View History

2019-11-11 23:01:05 +01:00
include(FetchContent)
FetchContent_Declare(
WithProject
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithProject
)
FetchContent_Declare(
WithoutProject
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithoutProject
)
2020-08-30 11:54:41 +02:00
FetchContent_Declare(
ProjectSubdir
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithoutProject
SOURCE_SUBDIR ProjectSubdir
)
2019-11-11 23:01:05 +01:00
# Order is important and will be verified by test output
2020-08-30 11:54:41 +02:00
FetchContent_MakeAvailable(WithProject WithoutProject ProjectSubdir)
2019-11-11 23:01:05 +01:00
get_property(addedWith GLOBAL PROPERTY FetchWithProject SET)
if(NOT addedWith)
2020-08-30 11:54:41 +02:00
message(SEND_ERROR "Project with top level CMakeLists.txt not added")
endif()
get_property(addedSubdir GLOBAL PROPERTY FetchWithSubProject SET)
if(NOT addedSubdir)
message(SEND_ERROR "Project with CMakeLists.txt in subdir not added")
2019-11-11 23:01:05 +01:00
endif()
include(${withoutproject_SOURCE_DIR}/confirmMessage.cmake)