diff options
author | Craig Scott <craig.scott@crascit.com> | 2020-05-16 06:57:01 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2020-05-16 07:01:10 (GMT) |
commit | 592085b94bb9b9c55f20fa6b13c2a3c0a7ab5d33 (patch) | |
tree | 2acf99a864db78f0e0a07d742b931b8fcafe69f5 /Tests | |
parent | ec1b3992dbfb54edb777988766440295f1f1f1d3 (diff) | |
download | CMake-592085b94bb9b9c55f20fa6b13c2a3c0a7ab5d33.zip CMake-592085b94bb9b9c55f20fa6b13c2a3c0a7ab5d33.tar.gz CMake-592085b94bb9b9c55f20fa6b13c2a3c0a7ab5d33.tar.bz2 |
FetchContent: Add support for SOURCE_SUBDIR
Fixes: #19875
Diffstat (limited to 'Tests')
3 files changed, 17 insertions, 2 deletions
diff --git a/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt b/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt index 6e6c730..711de6b 100644 --- a/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt +++ b/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt @@ -1,2 +1,3 @@ Confirmation project has been added +.*Confirmation subproject has been added .*Confirmation script has been called diff --git a/Tests/RunCMake/FetchContent/MakeAvailable.cmake b/Tests/RunCMake/FetchContent/MakeAvailable.cmake index a93f1f7..d7fc55c 100644 --- a/Tests/RunCMake/FetchContent/MakeAvailable.cmake +++ b/Tests/RunCMake/FetchContent/MakeAvailable.cmake @@ -8,13 +8,22 @@ FetchContent_Declare( WithoutProject SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithoutProject ) +FetchContent_Declare( + ProjectSubdir + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithoutProject + SOURCE_SUBDIR ProjectSubdir +) # Order is important and will be verified by test output -FetchContent_MakeAvailable(WithProject WithoutProject) +FetchContent_MakeAvailable(WithProject WithoutProject ProjectSubdir) get_property(addedWith GLOBAL PROPERTY FetchWithProject SET) if(NOT addedWith) - message(SEND_ERROR "Subdir with CMakeLists.txt not added") + 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") endif() include(${withoutproject_SOURCE_DIR}/confirmMessage.cmake) diff --git a/Tests/RunCMake/FetchContent/WithoutProject/ProjectSubdir/CMakeLists.txt b/Tests/RunCMake/FetchContent/WithoutProject/ProjectSubdir/CMakeLists.txt new file mode 100644 index 0000000..216eeb1 --- /dev/null +++ b/Tests/RunCMake/FetchContent/WithoutProject/ProjectSubdir/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.13) +project(ProjectSubdir LANGUAGES NONE) + +set_property(GLOBAL PROPERTY FetchWithSubProject YES) +message(STATUS "Confirmation subproject has been added") |