summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auxiliary/vim/syntax/cmake.vim2
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/policy/CMP0151.rst28
-rw-r--r--Help/prop_tgt/AUTOGEN_USE_SYSTEM_INCLUDE.rst17
-rw-r--r--Help/release/dev/autogen-system-include.rst7
-rw-r--r--Help/variable/CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE.rst10
-rw-r--r--Source/cmGeneratorTarget.cxx23
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmPolicies.h4
-rw-r--r--Source/cmQtAutoGenInitializer.cxx26
-rw-r--r--Source/cmTarget.cxx1
-rw-r--r--Tests/QtAutogen/GlobalAutogenSystemUseInclude/CMakeLists.txt28
-rw-r--r--Tests/QtAutogen/GlobalAutogenSystemUseInclude/main.cpp4
-rw-r--r--Tests/QtAutogen/Tests.cmake1
-rw-r--r--Tests/RunCMake/Autogen/AutogenUseSystemIncludeCommon.cmake10
-rw-r--r--Tests/RunCMake/Autogen/AutogenUseSystemIncludeOff.cmake3
-rw-r--r--Tests/RunCMake/Autogen/AutogenUseSystemIncludeOn.cmake3
-rw-r--r--Tests/RunCMake/Autogen/CMP0151-common.cmake10
-rw-r--r--Tests/RunCMake/Autogen/CMP0151-new.cmake1
-rw-r--r--Tests/RunCMake/Autogen/CMP0151-old.cmake1
-rw-r--r--Tests/RunCMake/Autogen/Inspect.cmake13
-rw-r--r--Tests/RunCMake/Autogen/RunCMakeTest.cmake66
-rw-r--r--Tests/RunCMake/RunCMake.cmake2
25 files changed, 264 insertions, 1 deletions
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 91da85a..aefdcee 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -73,6 +73,7 @@ syn keyword cmakeProperty contained
\ AUTOGEN_ORIGIN_DEPENDS
\ AUTOGEN_PARALLEL
\ AUTOGEN_SOURCE_GROUP
+ \ AUTOGEN_USE_SYSTEM_INCLUDE
\ AUTOGEN_TARGETS_FOLDER
\ AUTOGEN_TARGET_DEPENDS
\ AUTOMOC
@@ -683,6 +684,7 @@ syn keyword cmakeVariable contained
\ CMAKE_ASM_VISIBILITY_PRESET
\ CMAKE_AUTOGEN_ORIGIN_DEPENDS
\ CMAKE_AUTOGEN_PARALLEL
+ \ CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE
\ CMAKE_AUTOGEN_VERBOSE
\ CMAKE_AUTOMOC
\ CMAKE_AUTOMOC_COMPILER_PREDEFINES
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index ff57390..7c48806 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.27
.. toctree::
:maxdepth: 1
+ CMP0151: AUTOMOC include directory is a system include directory by default. </policy/CMP0151>
CMP0150: ExternalProject_Add and FetchContent_Declare treat relative git repository paths as being relative to parent project's remote. </policy/CMP0150>
CMP0149: Visual Studio generators select latest Windows SDK by default. </policy/CMP0149>
CMP0148: The FindPythonInterp and FindPythonLibs modules are removed. </policy/CMP0148>
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index c0e2ee2..8ee5573 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -133,6 +133,7 @@ Properties on Targets
/prop_tgt/AUTOGEN_ORIGIN_DEPENDS
/prop_tgt/AUTOGEN_PARALLEL
/prop_tgt/AUTOGEN_TARGET_DEPENDS
+ /prop_tgt/AUTOGEN_USE_SYSTEM_INCLUDE
/prop_tgt/AUTOMOC
/prop_tgt/AUTOMOC_COMPILER_PREDEFINES
/prop_tgt/AUTOMOC_DEPEND_FILTERS
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 34d2c50..8b055b0 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -397,6 +397,7 @@ Variables that Control the Build
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG
/variable/CMAKE_AUTOGEN_ORIGIN_DEPENDS
/variable/CMAKE_AUTOGEN_PARALLEL
+ /variable/CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE
/variable/CMAKE_AUTOGEN_VERBOSE
/variable/CMAKE_AUTOMOC
/variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES
diff --git a/Help/policy/CMP0151.rst b/Help/policy/CMP0151.rst
new file mode 100644
index 0000000..c12f595
--- /dev/null
+++ b/Help/policy/CMP0151.rst
@@ -0,0 +1,28 @@
+CMP0151
+-------
+
+.. versionadded:: 3.27
+
+AUTOMOC include directory is a system include directory by default.
+
+Headers generated for :ref:`Qt AUTOMOC` are placed in target-specific include
+directories. CMake 3.26 and older added these as normal include directories.
+CMake 3.27 and newer prefer to add them as system include directories.
+This policy provides compatibility for projects that have not been updated
+to expect this.
+
+If the :prop_tgt:`AUTOGEN_USE_SYSTEM_INCLUDE` target property is set,
+perhaps via the :variable:`CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE` variable,
+then its value is used regardless of the setting of this policy.
+
+The ``OLD`` behavior for this policy is to add autogen include directory to
+the target's include directories.
+The ``NEW`` behavior for this policy is to add autogen include directory to
+the target's system include directories.
+
+This policy was introduced in CMake version 3.27. Use the
+:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
+Unlike many policies, CMake version |release| does *not* warn
+when this policy is not set and simply uses ``OLD`` behavior.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_tgt/AUTOGEN_USE_SYSTEM_INCLUDE.rst b/Help/prop_tgt/AUTOGEN_USE_SYSTEM_INCLUDE.rst
new file mode 100644
index 0000000..84212c8
--- /dev/null
+++ b/Help/prop_tgt/AUTOGEN_USE_SYSTEM_INCLUDE.rst
@@ -0,0 +1,17 @@
+AUTOGEN_USE_SYSTEM_INCLUDE
+--------------------------
+
+``AUTOGEN_USE_SYSTEM_INCLUDE`` is a boolean property that can be set
+on a target to indicate that the autogen target include directory should
+be added as a system include directory or normal include directory to the
+target.
+
+If this property is not set, the autogen target include directory is added
+as a system include directory by default. See policy :policy:`CMP0151`.
+
+See the :manual:`cmake-qt(7)` manual for more information on using CMake
+with Qt.
+
+This property is initialized by the
+:variable:`CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE` variable if it is set when
+a target is created.
diff --git a/Help/release/dev/autogen-system-include.rst b/Help/release/dev/autogen-system-include.rst
new file mode 100644
index 0000000..aea81be
--- /dev/null
+++ b/Help/release/dev/autogen-system-include.rst
@@ -0,0 +1,7 @@
+autogen-system-include
+----------------------
+
+* The :prop_tgt:`AUTOGEN_USE_SYSTEM_INCLUDE` target property and
+ corresponding :variable:`CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE` were
+ added to explicitly control whether autogen headers are
+ considered system headers.
diff --git a/Help/variable/CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE.rst b/Help/variable/CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE.rst
new file mode 100644
index 0000000..80ed847
--- /dev/null
+++ b/Help/variable/CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE.rst
@@ -0,0 +1,10 @@
+CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE
+--------------------------------
+
+.. versionadded:: 3.27
+
+This variable is used to initialize the :prop_tgt:`AUTOGEN_USE_SYSTEM_INCLUDE`
+property on all targets as they are created. See that target property for
+additional information.
+
+By default ``CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE`` is unset.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 1c37e52..2eae245 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -731,6 +731,29 @@ void cmGeneratorTarget::AddIncludeDirectory(const std::string& src,
BT<std::string>(src, this->Makefile->GetBacktrace()), true));
}
+void cmGeneratorTarget::AddSystemIncludeDirectory(std::string const& inc,
+ std::string const& lang)
+{
+ std::string config_upper;
+ auto const& configs =
+ this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
+
+ for (auto const& config : configs) {
+ std::string inc_with_config = inc;
+ if (!config.empty()) {
+ cmSystemTools::ReplaceString(inc_with_config, "$<CONFIG>", config);
+ config_upper = cmSystemTools::UpperCase(config);
+ }
+ auto const& key = cmStrCat(config_upper, "/", lang);
+ this->Target->AddSystemIncludeDirectories({ inc_with_config });
+ this->SystemIncludesCache[key].emplace_back(inc_with_config);
+
+ // SystemIncludesCache should be sorted so that binary search can be used
+ std::sort(this->SystemIncludesCache[key].begin(),
+ this->SystemIncludesCache[key].end());
+ }
+}
+
std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
cmSourceFile const* sf) const
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 87227fd..8b44eb5 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -912,6 +912,8 @@ public:
std::vector<std::string> GetGeneratedISPCObjects(
std::string const& config) const;
+ void AddSystemIncludeDirectory(std::string const& inc,
+ std::string const& lang);
bool AddHeaderSetVerification();
std::string GenerateHeaderSetVerificationFile(
cmSourceFile& source, const std::string& dir,
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 23e50a9..a0030d3 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -455,6 +455,10 @@ class cmMakefile;
"ExternalProject_Add and FetchContent_Declare commands " \
"treat relative GIT_REPOSITORY paths as being relative " \
"to the parent project's remote.", \
+ 3, 27, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0151, \
+ "AUTOMOC include directory is a system include directory by " \
+ "default.", \
3, 27, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 5c32093..d897f0e 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -574,7 +574,31 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
// Add autogen include directory to the origin target INCLUDE_DIRECTORIES
if (this->MocOrUicEnabled() || (this->Rcc.Enabled && this->MultiConfig)) {
- this->GenTarget->AddIncludeDirectory(this->Dir.IncludeGenExp, true);
+ auto addBefore = false;
+ auto const& value =
+ this->GenTarget->GetProperty("AUTOGEN_USE_SYSTEM_INCLUDE");
+ if (value.IsSet()) {
+ if (cmIsOn(value)) {
+ this->GenTarget->AddSystemIncludeDirectory(this->Dir.IncludeGenExp,
+ "CXX");
+ } else {
+ addBefore = true;
+ }
+ } else {
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0151)) {
+ case cmPolicies::WARN:
+ case cmPolicies::OLD:
+ addBefore = true;
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ this->GenTarget->AddSystemIncludeDirectory(this->Dir.IncludeGenExp,
+ "CXX");
+ break;
+ }
+ }
+ this->GenTarget->AddIncludeDirectory(this->Dir.IncludeGenExp, addBefore);
}
// Scan files
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 01c5cc3..0fbe430 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -550,6 +550,7 @@ TargetProperty const StaticTargetProperties[] = {
// -- Autogen
{ "AUTOGEN_ORIGIN_DEPENDS"_s, IC::CanCompileSources },
{ "AUTOGEN_PARALLEL"_s, IC::CanCompileSources },
+ { "AUTOGEN_USE_SYSTEM_INCLUDE"_s, IC::CanCompileSources },
// -- moc
{ "AUTOMOC_DEPEND_FILTERS"_s, IC::CanCompileSources },
// -- C++
diff --git a/Tests/QtAutogen/GlobalAutogenSystemUseInclude/CMakeLists.txt b/Tests/QtAutogen/GlobalAutogenSystemUseInclude/CMakeLists.txt
new file mode 100644
index 0000000..1095fb1
--- /dev/null
+++ b/Tests/QtAutogen/GlobalAutogenSystemUseInclude/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required(VERSION 3.26)
+project(GlobalAutogenSystemUseInclude)
+
+include("../AutogenCoreTest.cmake")
+
+block()
+ set(test_autogen_use_system_include ON)
+ set(CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE ${test_autogen_use_system_include})
+
+ add_executable(autogen_test_on main.cpp)
+ get_target_property(target_autogen_use_system_include autogen_test_on AUTOGEN_USE_SYSTEM_INCLUDE)
+
+ if(NOT ${CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE} STREQUAL ${target_autogen_use_system_include})
+ message(FATAL_ERROR "CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE not set")
+ endif()
+endblock()
+
+block()
+ set(test_autogen_use_system_include OFF)
+ set(CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE ${test_autogen_use_system_include})
+
+ add_executable(autogen_test_off main.cpp)
+ get_target_property(target_autogen_use_system_include autogen_test_off AUTOGEN_USE_SYSTEM_INCLUDE)
+
+ if(NOT ${CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE} STREQUAL ${target_autogen_use_system_include})
+ message(FATAL_ERROR "CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE not set")
+ endif()
+endblock()
diff --git a/Tests/QtAutogen/GlobalAutogenSystemUseInclude/main.cpp b/Tests/QtAutogen/GlobalAutogenSystemUseInclude/main.cpp
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/QtAutogen/GlobalAutogenSystemUseInclude/main.cpp
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake
index cdce2b1..3e4f04d 100644
--- a/Tests/QtAutogen/Tests.cmake
+++ b/Tests/QtAutogen/Tests.cmake
@@ -3,6 +3,7 @@ ADD_AUTOGEN_TEST(AutogenOriginDependsOff autogenOriginDependsOff)
ADD_AUTOGEN_TEST(AutogenOriginDependsOn)
ADD_AUTOGEN_TEST(AutogenTargetDepends)
ADD_AUTOGEN_TEST(Complex QtAutogen)
+ADD_AUTOGEN_TEST(GlobalAutogenSystemUseInclude)
ADD_AUTOGEN_TEST(GlobalAutogenTarget)
ADD_AUTOGEN_TEST(GlobalAutogenExecutable)
ADD_AUTOGEN_TEST(LowMinimumVersion lowMinimumVersion)
diff --git a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeCommon.cmake b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeCommon.cmake
new file mode 100644
index 0000000..bbefd5f
--- /dev/null
+++ b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeCommon.cmake
@@ -0,0 +1,10 @@
+enable_language(CXX)
+
+find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)
+
+set(CMAKE_AUTOMOC ON)
+
+add_library(dummy SHARED empty.cpp)
+target_link_libraries(dummy Qt${with_qt_version}::Core
+ Qt${with_qt_version}::Widgets
+ Qt${with_qt_version}::Gui)
diff --git a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOff.cmake b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOff.cmake
new file mode 100644
index 0000000..dfdbb98
--- /dev/null
+++ b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOff.cmake
@@ -0,0 +1,3 @@
+include("${CMAKE_CURRENT_LIST_DIR}/AutogenUseSystemIncludeCommon.cmake")
+
+set_target_properties(dummy PROPERTIES AUTOGEN_USE_SYSTEM_INCLUDE OFF)
diff --git a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOn.cmake b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOn.cmake
new file mode 100644
index 0000000..f556ed4
--- /dev/null
+++ b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOn.cmake
@@ -0,0 +1,3 @@
+include("${CMAKE_CURRENT_LIST_DIR}/AutogenUseSystemIncludeCommon.cmake")
+
+set_target_properties(dummy PROPERTIES AUTOGEN_USE_SYSTEM_INCLUDE ON)
diff --git a/Tests/RunCMake/Autogen/CMP0151-common.cmake b/Tests/RunCMake/Autogen/CMP0151-common.cmake
new file mode 100644
index 0000000..bbefd5f
--- /dev/null
+++ b/Tests/RunCMake/Autogen/CMP0151-common.cmake
@@ -0,0 +1,10 @@
+enable_language(CXX)
+
+find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)
+
+set(CMAKE_AUTOMOC ON)
+
+add_library(dummy SHARED empty.cpp)
+target_link_libraries(dummy Qt${with_qt_version}::Core
+ Qt${with_qt_version}::Widgets
+ Qt${with_qt_version}::Gui)
diff --git a/Tests/RunCMake/Autogen/CMP0151-new.cmake b/Tests/RunCMake/Autogen/CMP0151-new.cmake
new file mode 100644
index 0000000..9c77e58
--- /dev/null
+++ b/Tests/RunCMake/Autogen/CMP0151-new.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/CMP0151-common.cmake")
diff --git a/Tests/RunCMake/Autogen/CMP0151-old.cmake b/Tests/RunCMake/Autogen/CMP0151-old.cmake
new file mode 100644
index 0000000..9c77e58
--- /dev/null
+++ b/Tests/RunCMake/Autogen/CMP0151-old.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/CMP0151-common.cmake")
diff --git a/Tests/RunCMake/Autogen/Inspect.cmake b/Tests/RunCMake/Autogen/Inspect.cmake
new file mode 100644
index 0000000..d5dc4b4
--- /dev/null
+++ b/Tests/RunCMake/Autogen/Inspect.cmake
@@ -0,0 +1,13 @@
+enable_language(CXX)
+
+set(info "")
+foreach(var
+ CMAKE_INCLUDE_FLAG_CXX
+ CMAKE_INCLUDE_SYSTEM_FLAG_CXX
+ )
+ if(DEFINED ${var})
+ string(APPEND info "set(${var} \"${${var}}\")\n")
+ endif()
+endforeach()
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}")
diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake
index 6a3c49b..4505132 100644
--- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake
@@ -22,4 +22,70 @@ if (DEFINED with_qt_version)
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(MocPredefs-build ${CMAKE_COMMAND} --build . --config Debug)
endblock()
+
+ # Detect information from the toolchain:
+ # - CMAKE_INCLUDE_FLAG_CXX
+ # - CMAKE_INCLUDE_SYSTEM_FLAG_CXX
+ run_cmake(Inspect)
+ include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
+
+ if(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+ if(RunCMake_GENERATOR MATCHES "Visual Studio")
+ string(REGEX REPLACE "^-" "/" test_expect_stdout "${CMAKE_INCLUDE_SYSTEM_FLAG_CXX}")
+ else()
+ set(test_expect_stdout "-*${CMAKE_INCLUDE_SYSTEM_FLAG_CXX}")
+ endif()
+ string(APPEND test_expect_stdout " *(\"[^\"]*|([^ ]|\\ )*)[\\/]dummy_autogen[\\/]include")
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ string(APPEND test_expect_stdout "_Debug")
+ endif()
+
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0151-new-build)
+ run_cmake_with_options(CMP0151-new ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
+ message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}")
+ run_cmake_command(CMP0151-new-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
+ endblock()
+
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutogenUseSystemIncludeOn-build)
+ run_cmake_with_options(AutogenUseSystemIncludeOn ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
+ message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}")
+ run_cmake_command(AutogenUseSystemIncludeOn ${CMAKE_COMMAND} --build . --config Debug --verbose)
+ endblock()
+ endif()
+
+ if(CMAKE_INCLUDE_FLAG_CXX)
+ if(RunCMake_GENERATOR MATCHES "Visual Studio")
+ string(REGEX REPLACE "^-" "/" test_expect_stdout "${CMAKE_INCLUDE_FLAG_CXX}")
+ else()
+ set(test_expect_stdout "-*${CMAKE_INCLUDE_FLAG_CXX}")
+ endif()
+ string(APPEND test_expect_stdout " *(\"[^\"]*|([^ ]|\\ )*)[\\/]dummy_autogen[\\/]include")
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ string(APPEND test_expect_stdout "_Debug")
+ endif()
+
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0151-old-build)
+ run_cmake_with_options(CMP0151-old ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=OLD)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
+ message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}")
+ run_cmake_command(CMP0151-old-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
+ endblock()
+
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutogenUseSystemIncludeOff-build)
+ run_cmake_with_options(AutogenUseSystemIncludeOff ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
+ message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}")
+ run_cmake_command(AutogenUseSystemIncludeOff ${CMAKE_COMMAND} --build . --config Debug --verbose)
+ endblock()
+ endif()
endif ()
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index b8efe35..18dde94 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -47,6 +47,8 @@ function(run_cmake test)
elseif(EXISTS ${top_src}/${test}-${o}.txt)
file(READ ${top_src}/${test}-${o}.txt expect_${o})
string(REGEX REPLACE "\n+$" "" expect_${o} "${expect_${o}}")
+ elseif(DEFINED RunCMake_TEST_EXPECT_${o})
+ string(REGEX REPLACE "\n+$" "" expect_${o} "${RunCMake_TEST_EXPECT_${o}}")
else()
unset(expect_${o})
endif()