diff options
Diffstat (limited to 'Tests/RunCMake/FetchContent')
17 files changed, 72 insertions, 0 deletions
diff --git a/Tests/RunCMake/FetchContent/IncludesNonSystem/CMakeLists.txt b/Tests/RunCMake/FetchContent/IncludesNonSystem/CMakeLists.txt new file mode 100644 index 0000000..f319e01 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesNonSystem/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(barnonsys STATIC bar.cpp) +add_executable(foononsys foo.cpp) diff --git a/Tests/RunCMake/FetchContent/IncludesNonSystem/bar.cpp b/Tests/RunCMake/FetchContent/IncludesNonSystem/bar.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesNonSystem/bar.cpp diff --git a/Tests/RunCMake/FetchContent/IncludesNonSystem/foo.cpp b/Tests/RunCMake/FetchContent/IncludesNonSystem/foo.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesNonSystem/foo.cpp diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/CMakeLists.txt b/Tests/RunCMake/FetchContent/IncludesSystem/CMakeLists.txt new file mode 100644 index 0000000..60c6820 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/CMakeLists.txt @@ -0,0 +1,20 @@ +project(SystemSub NONE) + +FetchContent_Declare( + SubSub1 + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/SubSub1 + SYSTEM +) +FetchContent_Declare( + SubSub2 + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/SubSub2 +) + +FetchContent_MakeAvailable(SubSub1 SubSub2) + +add_library(bar STATIC bar.cpp) + +add_library(foo STATIC foo.cpp) +set_target_properties(foo PROPERTIES SYSTEM OFF) + +add_executable(zot zot.cpp) diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/CMakeLists.txt b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/CMakeLists.txt new file mode 100644 index 0000000..291339b --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(subsub1bar STATIC bar.cpp) + +add_library(subsub1foo STATIC foo.cpp) +set_target_properties(subsub1foo PROPERTIES SYSTEM OFF) + +add_executable(subsub1zot zot.cpp) diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/bar.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/bar.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/bar.cpp diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/foo.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/foo.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/foo.cpp diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/zot.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/zot.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/zot.cpp diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/CMakeLists.txt b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/CMakeLists.txt new file mode 100644 index 0000000..5755742 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(subsub2bar STATIC bar.cpp) + +add_library(subsub2foo STATIC foo.cpp) +set_target_properties(subsub2foo PROPERTIES SYSTEM OFF) + +add_executable(subsub2zot zot.cpp) diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/bar.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/bar.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/bar.cpp diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/foo.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/foo.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/foo.cpp diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/zot.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/zot.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/zot.cpp diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/bar.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/bar.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/bar.cpp diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/foo.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/foo.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/foo.cpp diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/zot.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/zot.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FetchContent/IncludesSystem/zot.cpp diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index e83c45e..3b91e24 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -8,6 +8,7 @@ run_cmake(FirstDetailsWin) run_cmake(DownloadTwice) run_cmake(DownloadFile) run_cmake(SameGenerator) +run_cmake(System) run_cmake(VarDefinitions) run_cmake(VarPassthroughs) run_cmake(GetProperties) diff --git a/Tests/RunCMake/FetchContent/System.cmake b/Tests/RunCMake/FetchContent/System.cmake new file mode 100644 index 0000000..c10e2af --- /dev/null +++ b/Tests/RunCMake/FetchContent/System.cmake @@ -0,0 +1,37 @@ +enable_language(CXX) + +include(FetchContent) + +FetchContent_Declare( + IncludesSystem + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/IncludesSystem + SYSTEM +) +FetchContent_MakeAvailable(IncludesSystem) + +FetchContent_Declare( + IncludesNonSystem + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/IncludesNonSystem +) +FetchContent_MakeAvailable(IncludesNonSystem) + +function(check_target_system target expected_value) + get_target_property(var ${target} SYSTEM) + if ((var AND NOT expected_value) OR (NOT var AND expected_value)) + message(SEND_ERROR "\ +The 'SYSTEM' property of ${target} should be ${expected_value}, \ +but got ${var}") + endif() +endfunction() + +check_target_system(foo OFF) +check_target_system(bar ON) +check_target_system(zot ON) +check_target_system(subsub1foo OFF) +check_target_system(subsub1bar ON) +check_target_system(subsub1zot ON) +check_target_system(subsub2foo OFF) +check_target_system(subsub2bar ON) +check_target_system(subsub2zot ON) +check_target_system(foononsys OFF) +check_target_system(barnonsys OFF) |