diff options
author | Brad King <brad.king@kitware.com> | 2023-10-18 14:08:34 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-10-18 14:08:49 (GMT) |
commit | a3fbc255ff200ba091485b05c41e1c111b2f0564 (patch) | |
tree | 81fabbb7a0c86f21f4448dd17ea937213de2981f /Tests | |
parent | 48fdc6b98a21492aa04fbbfdc4798d361b8eace7 (diff) | |
parent | 704acca96bcdf30c15bb64f2b7a92c21decc46ee (diff) | |
download | CMake-a3fbc255ff200ba091485b05c41e1c111b2f0564.zip CMake-a3fbc255ff200ba091485b05c41e1c111b2f0564.tar.gz CMake-a3fbc255ff200ba091485b05c41e1c111b2f0564.tar.bz2 |
Merge topic 'project-include-multiple'
704acca96b CMAKE_PROJECT_INCLUDE: Add support for including multiple files
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8884
Diffstat (limited to 'Tests')
20 files changed, 72 insertions, 22 deletions
diff --git a/Tests/RunCMake/project/CodeInjection-stdout.txt b/Tests/RunCMake/project/CodeInjection-stdout.txt deleted file mode 100644 index 88ac966..0000000 --- a/Tests/RunCMake/project/CodeInjection-stdout.txt +++ /dev/null @@ -1,10 +0,0 @@ -(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE -(-- )?Included CMAKE_TOOLCHAIN_FILE -.*Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES first file -(-- )?Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES second file -(-- )?Included CMAKE_PROJECT_INCLUDE -(-- )?Calling sub-project -(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE -(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE -(-- )?Included CMAKE_PROJECT_INCLUDE -(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_include.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_include.cmake deleted file mode 100644 index f3f0a7e..0000000 --- a/Tests/RunCMake/project/CodeInjection/cmake_project_include.cmake +++ /dev/null @@ -1 +0,0 @@ -message(STATUS "Included CMAKE_PROJECT_INCLUDE") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_include_before.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_include_before.cmake deleted file mode 100644 index 01d53c9..0000000 --- a/Tests/RunCMake/project/CodeInjection/cmake_project_include_before.cmake +++ /dev/null @@ -1 +0,0 @@ -message(STATUS "Included CMAKE_PROJECT_INCLUDE_BEFORE") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_includes_1.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_1.cmake new file mode 100644 index 0000000..2bc65cf --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_1.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_INCLUDE first file") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_includes_2.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_2.cmake new file mode 100644 index 0000000..df7240c --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_2.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_INCLUDE second file") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_1.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_1.cmake new file mode 100644 index 0000000..20bea78 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_1.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_INCLUDE_BEFORE first file") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_2.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_2.cmake new file mode 100644 index 0000000..91b59d1 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_2.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_INCLUDE_BEFORE second file") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include.cmake deleted file mode 100644 index d68de6a..0000000 --- a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include.cmake +++ /dev/null @@ -1 +0,0 @@ -message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include_before.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include_before.cmake deleted file mode 100644 index ef3bfc0..0000000 --- a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include_before.cmake +++ /dev/null @@ -1 +0,0 @@ -message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_1.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_1.cmake new file mode 100644 index 0000000..fe0fe4a --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_1.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE first file") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_2.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_2.cmake new file mode 100644 index 0000000..c36fb52 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_2.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE second file") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_1.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_1.cmake new file mode 100644 index 0000000..23ae05a --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_1.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE first file") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_2.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_2.cmake new file mode 100644 index 0000000..17f1d29 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_2.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE second file") diff --git a/Tests/RunCMake/project/CodeInjection/initial_cache.cmake b/Tests/RunCMake/project/CodeInjection/initial_cache_1.cmake index 6c8995b..43bb817 100644 --- a/Tests/RunCMake/project/CodeInjection/initial_cache.cmake +++ b/Tests/RunCMake/project/CodeInjection/initial_cache_1.cmake @@ -1,10 +1,9 @@ set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/passthrough_toolchain_file.cmake" CACHE FILEPATH "") -set(CMAKE_PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_include.cmake" CACHE FILEPATH "") -set(CMAKE_PROJECT_INCLUDE_BEFORE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_include_before.cmake" CACHE FILEPATH "") -set(CMAKE_PROJECT_SubProj_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_include.cmake" CACHE FILEPATH "") -set(CMAKE_PROJECT_SubProj_INCLUDE_BEFORE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_include_before.cmake" CACHE FILEPATH "") +set(CMAKE_PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_1.cmake" CACHE FILEPATH "") +set(CMAKE_PROJECT_INCLUDE_BEFORE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_before_1.cmake" CACHE FILEPATH "") +set(CMAKE_PROJECT_SubProj_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_1.cmake" CACHE FILEPATH "") +set(CMAKE_PROJECT_SubProj_INCLUDE_BEFORE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_before_1.cmake" CACHE FILEPATH "") set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES "${CMAKE_CURRENT_LIST_DIR}/cmake_project_top_level_includes_1.cmake" - "${CMAKE_CURRENT_LIST_DIR}/cmake_project_top_level_includes_2.cmake" - CACHE STRING "" + CACHE FILEPATH "" ) diff --git a/Tests/RunCMake/project/CodeInjection/initial_cache_2.cmake b/Tests/RunCMake/project/CodeInjection/initial_cache_2.cmake new file mode 100644 index 0000000..09fcbfd --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/initial_cache_2.cmake @@ -0,0 +1,27 @@ +set(CMAKE_TOOLCHAIN_FILE + "${CMAKE_CURRENT_LIST_DIR}/passthrough_toolchain_file.cmake" CACHE FILEPATH "") +set(CMAKE_PROJECT_INCLUDE + "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_1.cmake" + "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_2.cmake" + CACHE STRING "" +) +set(CMAKE_PROJECT_INCLUDE_BEFORE + "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_before_1.cmake" + "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_before_2.cmake" + CACHE STRING "" +) +set(CMAKE_PROJECT_SubProj_INCLUDE + "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_1.cmake" + "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_2.cmake" + CACHE STRING "" +) +set(CMAKE_PROJECT_SubProj_INCLUDE_BEFORE + "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_before_1.cmake" + "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_before_2.cmake" + CACHE STRING "" +) +set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES + "${CMAKE_CURRENT_LIST_DIR}/cmake_project_top_level_includes_1.cmake" + "${CMAKE_CURRENT_LIST_DIR}/cmake_project_top_level_includes_2.cmake" + CACHE STRING "" +) diff --git a/Tests/RunCMake/project/CodeInjection1-stdout.txt b/Tests/RunCMake/project/CodeInjection1-stdout.txt new file mode 100644 index 0000000..7a780b7 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection1-stdout.txt @@ -0,0 +1,9 @@ +(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE first file +(-- )?Included CMAKE_TOOLCHAIN_FILE +.*Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES first file +(-- )?Included CMAKE_PROJECT_INCLUDE first file +(-- )?Calling sub-project +(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE first file +(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE first file +(-- )?Included CMAKE_PROJECT_INCLUDE first file +(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE first file diff --git a/Tests/RunCMake/project/CodeInjection.cmake b/Tests/RunCMake/project/CodeInjection1.cmake index dcf56a1..dcf56a1 100644 --- a/Tests/RunCMake/project/CodeInjection.cmake +++ b/Tests/RunCMake/project/CodeInjection1.cmake diff --git a/Tests/RunCMake/project/CodeInjection2-stdout.txt b/Tests/RunCMake/project/CodeInjection2-stdout.txt new file mode 100644 index 0000000..5c18cdf --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection2-stdout.txt @@ -0,0 +1,16 @@ +(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE first file +(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE second file +(-- )?Included CMAKE_TOOLCHAIN_FILE +.*Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES first file +(-- )?Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES second file +(-- )?Included CMAKE_PROJECT_INCLUDE first file +(-- )?Included CMAKE_PROJECT_INCLUDE second file +(-- )?Calling sub-project +(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE first file +(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE second file +(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE first file +(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE second file +(-- )?Included CMAKE_PROJECT_INCLUDE first file +(-- )?Included CMAKE_PROJECT_INCLUDE second file +(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE first file +(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE second file diff --git a/Tests/RunCMake/project/CodeInjection2.cmake b/Tests/RunCMake/project/CodeInjection2.cmake new file mode 100644 index 0000000..dcf56a1 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection2.cmake @@ -0,0 +1 @@ +add_subdirectory(CodeInjection) diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index 0f3716f..4ec1d48 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -5,8 +5,12 @@ include(RunCMake) # which tests some of the individual variables one at a time. # Here, we are focused on testing that the variables are all injected # at the expected points in the expected order. -run_cmake_with_options(CodeInjection - -C "${CMAKE_CURRENT_LIST_DIR}/CodeInjection/initial_cache.cmake" +run_cmake_with_options(CodeInjection1 + -C "${CMAKE_CURRENT_LIST_DIR}/CodeInjection/initial_cache_1.cmake" +) +# This checks that List variables are allowed. +run_cmake_with_options(CodeInjection2 + -C "${CMAKE_CURRENT_LIST_DIR}/CodeInjection/initial_cache_2.cmake" ) if(CMake_TEST_RESOURCES) |