diff options
Diffstat (limited to 'Tests/RunCMake/project')
17 files changed, 70 insertions, 0 deletions
diff --git a/Tests/RunCMake/project/CMP0096-OLD-stderr.txt b/Tests/RunCMake/project/CMP0096-OLD-stderr.txt new file mode 100644 index 0000000..beb7a84 --- /dev/null +++ b/Tests/RunCMake/project/CMP0096-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0096-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0096 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project/CodeInjection-stdout.txt b/Tests/RunCMake/project/CodeInjection-stdout.txt new file mode 100644 index 0000000..88ac966 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection-stdout.txt @@ -0,0 +1,10 @@ +(-- )?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 b/Tests/RunCMake/project/CodeInjection.cmake new file mode 100644 index 0000000..dcf56a1 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection.cmake @@ -0,0 +1 @@ +add_subdirectory(CodeInjection) diff --git a/Tests/RunCMake/project/CodeInjection/CMakeLists.txt b/Tests/RunCMake/project/CodeInjection/CMakeLists.txt new file mode 100644 index 0000000..8ee99d0 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/CMakeLists.txt @@ -0,0 +1,2 @@ +message(STATUS "Calling sub-project") +project(SubProj LANGUAGES NONE) diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_include.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_include.cmake new file mode 100644 index 0000000..f3f0a7e --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_include.cmake @@ -0,0 +1 @@ +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 new file mode 100644 index 0000000..01d53c9 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_include_before.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_INCLUDE_BEFORE") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include.cmake new file mode 100644 index 0000000..d68de6a --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include.cmake @@ -0,0 +1 @@ +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 new file mode 100644 index 0000000..ef3bfc0 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include_before.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_top_level_includes_1.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_top_level_includes_1.cmake new file mode 100644 index 0000000..73ad037 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_top_level_includes_1.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES first file") diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_top_level_includes_2.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_top_level_includes_2.cmake new file mode 100644 index 0000000..80f9705 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/cmake_project_top_level_includes_2.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES second file") diff --git a/Tests/RunCMake/project/CodeInjection/initial_cache.cmake b/Tests/RunCMake/project/CodeInjection/initial_cache.cmake new file mode 100644 index 0000000..6c8995b --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/initial_cache.cmake @@ -0,0 +1,10 @@ +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_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/CodeInjection/passthrough_toolchain_file.cmake b/Tests/RunCMake/project/CodeInjection/passthrough_toolchain_file.cmake new file mode 100644 index 0000000..d045712 --- /dev/null +++ b/Tests/RunCMake/project/CodeInjection/passthrough_toolchain_file.cmake @@ -0,0 +1 @@ +message(STATUS "Included CMAKE_TOOLCHAIN_FILE") diff --git a/Tests/RunCMake/project/LanguagesUsedButNotEnabled-result.txt b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/project/LanguagesUsedButNotEnabled-stderr.txt b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-stderr.txt new file mode 100644 index 0000000..bf9157b --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-stderr.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + The language CXX was requested for compilation but was not enabled. To + enable a language it needs to be specified in a 'project' or + 'enable_language' command in the root CMakeLists.txt diff --git a/Tests/RunCMake/project/LanguagesUsedButNotEnabled.cmake b/Tests/RunCMake/project/LanguagesUsedButNotEnabled.cmake new file mode 100644 index 0000000..caab687 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUsedButNotEnabled.cmake @@ -0,0 +1,3 @@ + +add_executable(UsesCXXLang empty.cxx) +set_source_files_properties(empty.cxx PROPERTIES GENERATED TRUE LANGUAGE CXX ) diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index 349e8ac..945d9ed 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -1,5 +1,14 @@ include(RunCMake) +# Use an initial cache file to define the project() variables +# to avoid long command lines. Also see the CMakeOnly test case +# 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" +) + if(CMake_TEST_RESOURCES) run_cmake(ExplicitRC) endif() @@ -8,6 +17,9 @@ run_cmake(LanguagesEmpty) run_cmake(LanguagesNONE) run_cmake(LanguagesTwice) run_cmake(LanguagesUnordered) +if(RunCMake_GENERATOR MATCHES "Make|Ninja") + run_cmake(LanguagesUsedButNotEnabled) +endif() run_cmake(ProjectDescription) run_cmake(ProjectDescription2) run_cmake(ProjectDescriptionNoArg) diff --git a/Tests/RunCMake/project/VersionMax-stderr.txt b/Tests/RunCMake/project/VersionMax-stderr.txt new file mode 100644 index 0000000..b789640 --- /dev/null +++ b/Tests/RunCMake/project/VersionMax-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at VersionMax.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0096 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ |