summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/cpack_gen/rpm.rst6
-rw-r--r--Help/generator/Visual Studio 10 2010.rst5
-rw-r--r--Help/generator/Visual Studio 11 2012.rst5
-rw-r--r--Help/generator/Visual Studio 12 2013.rst5
-rw-r--r--Help/generator/Visual Studio 14 2015.rst5
-rw-r--r--Help/generator/Visual Studio 15 2017.rst5
-rw-r--r--Help/generator/Visual Studio 16 2019.rst5
-rw-r--r--Help/generator/Visual Studio 17 2022.rst5
-rw-r--r--Help/policy/CMP0126.rst4
-rw-r--r--Help/prop_tgt/C_STANDARD.rst21
-rw-r--r--Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst2
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake5
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake5
-rw-r--r--Modules/Compiler/Clang.cmake3
-rw-r--r--Modules/Compiler/FujitsuClang-FindBinUtils.cmake6
-rw-r--r--Modules/Internal/CPack/CPackRPM.cmake15
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmGeneratorTarget.cxx14
-rw-r--r--Source/cmGeneratorTarget.h7
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx3
-rw-r--r--Source/cmMakefile.cxx23
-rw-r--r--Source/cmProjectCommand.cxx4
-rw-r--r--Tests/CMakeCommands/target_link_libraries/CMakeLists.txt2
-rw-r--r--Tests/CMakeCommands/target_link_libraries/SubDirA/CMakeLists.txt4
-rw-r--r--Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt4
-rw-r--r--Tests/CMakeCommands/target_link_libraries/TopDir.c6
-rw-r--r--Tests/RunCMake/CMP0126/CMP0126-WARN-default.cmake3
-rw-r--r--Tests/RunCMake/CMP0126/CMP0126-WARN-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0126/CMP0126-WARN.cmake5
-rw-r--r--Tests/RunCMake/CMP0126/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake20
-rw-r--r--Tests/RunCMake/CPack/tests/SUGGESTS/test_suggests.spec22
32 files changed, 190 insertions, 43 deletions
diff --git a/Help/cpack_gen/rpm.rst b/Help/cpack_gen/rpm.rst
index 5260a1d..322ab68 100644
--- a/Help/cpack_gen/rpm.rst
+++ b/Help/cpack_gen/rpm.rst
@@ -394,8 +394,10 @@ List of CPack RPM generator specific variables:
* Mandatory : NO
* Default : -
- May be used to set weak RPM dependencies (suggests). Note that you must
- enclose the complete requires string between quotes.
+ May be used to set weak RPM dependencies (suggests). If ``rpmbuild`` doesn't
+ support the ``Suggests`` tag, CPack will emit a warning and ignore this
+ variable. Note that you must enclose the complete requires string between
+ quotes.
.. variable:: CPACK_RPM_PACKAGE_PROVIDES
CPACK_RPM_<component>_PACKAGE_PROVIDES
diff --git a/Help/generator/Visual Studio 10 2010.rst b/Help/generator/Visual Studio 10 2010.rst
index b4376d8..c065550 100644
--- a/Help/generator/Visual Studio 10 2010.rst
+++ b/Help/generator/Visual Studio 10 2010.rst
@@ -9,8 +9,9 @@ generator using the name ``Visual Studio 10`` without the year component.
Project Types
^^^^^^^^^^^^^
-Only Visual C++ and C# projects may be generated. Other types of
-projects (Database, Website, etc.) are not supported.
+Only Visual C++ and C# projects may be generated (and Fortran with
+Intel compiler integration). Other types of projects (Database,
+Website, etc.) are not supported.
Platform Selection
^^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 11 2012.rst b/Help/generator/Visual Studio 11 2012.rst
index 932548b..3952228 100644
--- a/Help/generator/Visual Studio 11 2012.rst
+++ b/Help/generator/Visual Studio 11 2012.rst
@@ -9,8 +9,9 @@ generator using the name "Visual Studio 11" without the year component.
Project Types
^^^^^^^^^^^^^
-Only Visual C++ and C# projects may be generated. Other types of
-projects (JavaScript, Database, Website, etc.) are not supported.
+Only Visual C++ and C# projects may be generated (and Fortran with
+Intel compiler integration). Other types of projects (JavaScript,
+Database, Website, etc.) are not supported.
Platform Selection
^^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 12 2013.rst b/Help/generator/Visual Studio 12 2013.rst
index 3b4b1f2..54a4d7e 100644
--- a/Help/generator/Visual Studio 12 2013.rst
+++ b/Help/generator/Visual Studio 12 2013.rst
@@ -9,8 +9,9 @@ generator using the name "Visual Studio 12" without the year component.
Project Types
^^^^^^^^^^^^^
-Only Visual C++ and C# projects may be generated. Other types of
-projects (JavaScript, Powershell, Python, etc.) are not supported.
+Only Visual C++ and C# projects may be generated (and Fortran with
+Intel compiler integration). Other types of projects (JavaScript,
+Powershell, Python, etc.) are not supported.
Platform Selection
^^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 14 2015.rst b/Help/generator/Visual Studio 14 2015.rst
index 8257723..d704ab2 100644
--- a/Help/generator/Visual Studio 14 2015.rst
+++ b/Help/generator/Visual Studio 14 2015.rst
@@ -8,8 +8,9 @@ Generates Visual Studio 14 (VS 2015) project files.
Project Types
^^^^^^^^^^^^^
-Only Visual C++ and C# projects may be generated. Other types of
-projects (JavaScript, Powershell, Python, etc.) are not supported.
+Only Visual C++ and C# projects may be generated (and Fortran with
+Intel compiler integration). Other types of projects (JavaScript,
+Powershell, Python, etc.) are not supported.
Platform Selection
^^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 15 2017.rst b/Help/generator/Visual Studio 15 2017.rst
index a80c57d..a4f5f98 100644
--- a/Help/generator/Visual Studio 15 2017.rst
+++ b/Help/generator/Visual Studio 15 2017.rst
@@ -8,8 +8,9 @@ Generates Visual Studio 15 (VS 2017) project files.
Project Types
^^^^^^^^^^^^^
-Only Visual C++ and C# projects may be generated. Other types of
-projects (JavaScript, Powershell, Python, etc.) are not supported.
+Only Visual C++ and C# projects may be generated (and Fortran with
+Intel compiler integration). Other types of projects (JavaScript,
+Powershell, Python, etc.) are not supported.
Instance Selection
^^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 16 2019.rst b/Help/generator/Visual Studio 16 2019.rst
index 3da8091..72399e0 100644
--- a/Help/generator/Visual Studio 16 2019.rst
+++ b/Help/generator/Visual Studio 16 2019.rst
@@ -8,8 +8,9 @@ Generates Visual Studio 16 (VS 2019) project files.
Project Types
^^^^^^^^^^^^^
-Only Visual C++ and C# projects may be generated. Other types of
-projects (JavaScript, Powershell, Python, etc.) are not supported.
+Only Visual C++ and C# projects may be generated (and Fortran with
+Intel compiler integration). Other types of projects (JavaScript,
+Powershell, Python, etc.) are not supported.
Instance Selection
^^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 17 2022.rst b/Help/generator/Visual Studio 17 2022.rst
index c53f8b7..06deda4 100644
--- a/Help/generator/Visual Studio 17 2022.rst
+++ b/Help/generator/Visual Studio 17 2022.rst
@@ -13,8 +13,9 @@ Generates Visual Studio 17 (VS 2022) project files.
Project Types
^^^^^^^^^^^^^
-Only Visual C++ and C# projects may be generated. Other types of
-projects (JavaScript, Powershell, Python, etc.) are not supported.
+Only Visual C++ and C# projects may be generated (and Fortran with
+Intel compiler integration). Other types of projects (JavaScript,
+Powershell, Python, etc.) are not supported.
Instance Selection
^^^^^^^^^^^^^^^^^^
diff --git a/Help/policy/CMP0126.rst b/Help/policy/CMP0126.rst
index 4c8e928..0ced8fa 100644
--- a/Help/policy/CMP0126.rst
+++ b/Help/policy/CMP0126.rst
@@ -15,6 +15,8 @@ behavior for this policy is to keep the normal variable of the same name.
This policy was introduced in CMake version 3.21. Use the
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
Unlike many policies, CMake version |release| does *not* warn when the policy
-is not set and simply uses ``OLD`` behavior.
+is not set and simply uses ``OLD`` behavior. See documentation of the
+:variable:`CMAKE_POLICY_WARNING_CMP0126 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
+variable to control the warning.
.. include:: DEPRECATED.txt
diff --git a/Help/prop_tgt/C_STANDARD.rst b/Help/prop_tgt/C_STANDARD.rst
index e22b775..ecba2a8 100644
--- a/Help/prop_tgt/C_STANDARD.rst
+++ b/Help/prop_tgt/C_STANDARD.rst
@@ -11,7 +11,26 @@ flag such as ``-std=gnu11`` to the compile line. For compilers that
have no notion of a C standard level, such as Microsoft Visual C++ before
VS 16.7, this property has no effect.
-Supported values are ``90``, ``99``, ``11``, ``17``, ``23``.
+Supported values are:
+
+``90``
+ C89/C90
+
+``99``
+ C99
+
+``11``
+ C11
+
+``17``
+ .. versionadded:: 3.21
+
+ C17
+
+``23``
+ .. versionadded:: 3.21
+
+ C23
If the value requested does not result in a compile flag being added for
the compiler in use, a previous standard flag will be added instead. This
diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
index 9f68741..b991db2 100644
--- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
+++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
@@ -29,6 +29,8 @@ warn by default:
policy :policy:`CMP0112`.
* ``CMAKE_POLICY_WARNING_CMP0116`` controls the warning for
policy :policy:`CMP0116`.
+* ``CMAKE_POLICY_WARNING_CMP0126`` controls the warning for
+ policy :policy:`CMP0126`.
This variable should not be set by a project in CMake code. Project
developers running CMake may set this variable in their cache to
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index cd07ba9..0f80f9c 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -85,6 +85,11 @@ else()
# ARMClang need target options
"--target=arm-arm-none-eabi -mcpu=cortex-m3"
+
+ # MSVC needs at least one include directory for __has_include to function,
+ # but custom toolchains may run MSVC with no INCLUDE env var and no -I flags.
+ # Also avoid linking so this works with no LIB env var.
+ "-c -I__does_not_exist__"
)
endif()
if(CMAKE_C_COMPILER_TARGET)
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 3d1a7bb..556518f 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -80,6 +80,11 @@ else()
# ARMClang need target options
"--target=arm-arm-none-eabi -mcpu=cortex-m3"
+
+ # MSVC needs at least one include directory for __has_include to function,
+ # but custom toolchains may run MSVC with no INCLUDE env var and no -I flags.
+ # Also avoid linking so this works with no LIB env var.
+ "-c -I__does_not_exist__"
)
endif()
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 7035d93..f885eb0 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -56,6 +56,7 @@ else()
set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
string(COMPARE EQUAL "${CMAKE_${lang}_COMPILER_ID}" "AppleClang" __is_apple_clang)
+ string(COMPARE EQUAL "${CMAKE_${lang}_COMPILER_ID}" "FujitsuClang" __is_fujitsu_clang)
# '-flto=thin' available since Clang 3.9 and Xcode 8
# * http://clang.llvm.org/docs/ThinLTO.html#clang-llvm
@@ -65,6 +66,8 @@ else()
if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 8.0)
set(_CMAKE_LTO_THIN FALSE)
endif()
+ elseif(__is_fujitsu_clang)
+ set(_CMAKE_LTO_THIN FALSE)
else()
if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.9)
set(_CMAKE_LTO_THIN FALSE)
diff --git a/Modules/Compiler/FujitsuClang-FindBinUtils.cmake b/Modules/Compiler/FujitsuClang-FindBinUtils.cmake
new file mode 100644
index 0000000..4a6401d
--- /dev/null
+++ b/Modules/Compiler/FujitsuClang-FindBinUtils.cmake
@@ -0,0 +1,6 @@
+if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL "")
+ message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set")
+endif()
+
+set(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR ar)
+set(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB ranlib)
diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake
index bece2dd..47d2a5c 100644
--- a/Modules/Internal/CPack/CPackRPM.cmake
+++ b/Modules/Internal/CPack/CPackRPM.cmake
@@ -1074,6 +1074,21 @@ function(cpack_rpm_generate_package)
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "\n" ";" RPMBUILD_TAG_LIST "${RPMBUILD_TAG_LIST}")
+ # In some versions of RPM, weak dependency tags are present in the --querytags
+ # list, but unsupported by rpmbuild. A different method must be used to check
+ # if they are supported.
+
+ execute_process(
+ COMMAND ${RPM_EXECUTABLE} --suggests
+ ERROR_QUIET
+ RESULT_VARIABLE RPMBUILD_SUGGESTS_RESULT)
+
+ if(NOT RPMBUILD_SUGGESTS_RESULT EQUAL 0)
+ foreach(_WEAK_DEP SUGGESTS RECOMMENDS SUPPLEMENTS ENHANCES)
+ list(REMOVE_ITEM RPMBUILD_TAG_LIST ${_WEAK_DEP})
+ endforeach()
+ endif()
+
if(CPACK_RPM_PACKAGE_EPOCH)
set(TMP_RPM_EPOCH "Epoch: ${CPACK_RPM_PACKAGE_EPOCH}")
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 6e24a61..7542fa1 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,7 +2,7 @@
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 21)
set(CMake_VERSION_PATCH 0)
-set(CMake_VERSION_RC 1)
+set(CMake_VERSION_RC 2)
set(CMake_VERSION_IS_DIRTY 0)
# Start with the full version number used in tags. It has no dev info.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f268c6c..f1ef130 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -6346,11 +6346,11 @@ bool cmGeneratorTarget::IsLinkLookupScope(std::string const& n,
}
cm::optional<cmLinkItem> cmGeneratorTarget::LookupLinkItem(
- std::string const& n, cmListFileBacktrace const& bt) const
+ std::string const& n, cmListFileBacktrace const& bt,
+ LookupLinkItemScope* scope) const
{
cm::optional<cmLinkItem> maybeItem;
- cmLocalGenerator const* lg = this->LocalGenerator;
- if (this->IsLinkLookupScope(n, lg)) {
+ if (this->IsLinkLookupScope(n, scope->LG)) {
return maybeItem;
}
@@ -6358,7 +6358,7 @@ cm::optional<cmLinkItem> cmGeneratorTarget::LookupLinkItem(
if (name == this->GetName() || name.empty()) {
return maybeItem;
}
- maybeItem = this->ResolveLinkItem(name, bt, lg);
+ maybeItem = this->ResolveLinkItem(name, bt, scope->LG);
return maybeItem;
}
@@ -6385,9 +6385,10 @@ void cmGeneratorTarget::ExpandLinkItems(
&dagChecker, this, headTarget->LinkerLanguage),
libs);
cmMakefile const* mf = this->LocalGenerator->GetMakefile();
+ LookupLinkItemScope scope{ this->LocalGenerator };
for (std::string const& lib : libs) {
if (cm::optional<cmLinkItem> maybeItem =
- this->LookupLinkItem(lib, cge->GetBacktrace())) {
+ this->LookupLinkItem(lib, cge->GetBacktrace(), &scope)) {
if (!maybeItem->Target) {
// Report explicitly linked object files separately.
std::string const& maybeObj = maybeItem->AsStr();
@@ -7089,9 +7090,10 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
iface.HadContextSensitiveCondition,
iface.HadLinkLanguageSensitiveCondition);
std::vector<std::string> deps = cmExpandedList(info->SharedDeps);
+ LookupLinkItemScope scope{ this->LocalGenerator };
for (std::string const& dep : deps) {
if (cm::optional<cmLinkItem> maybeItem =
- this->LookupLinkItem(dep, cmListFileBacktrace())) {
+ this->LookupLinkItem(dep, cmListFileBacktrace(), &scope)) {
iface.SharedDeps.emplace_back(std::move(*maybeItem));
}
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index ed66fb1..6d2aa85 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -1042,8 +1042,13 @@ private:
bool& hadHeadSensitiveCondition,
bool& hadContextSensitiveCondition,
bool& hadLinkLanguageSensitiveCondition) const;
+ struct LookupLinkItemScope
+ {
+ cmLocalGenerator const* LG;
+ };
cm::optional<cmLinkItem> LookupLinkItem(std::string const& n,
- cmListFileBacktrace const& bt) const;
+ cmListFileBacktrace const& bt,
+ LookupLinkItemScope* scope) const;
std::vector<BT<std::string>> GetSourceFilePaths(
std::string const& config) const;
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index aafc9d5..4fab0b9 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -211,7 +211,6 @@ public:
platforms.emplace_back("Win32");
platforms.emplace_back("ARM");
platforms.emplace_back("ARM64");
- platforms.emplace_back("ARM64EC");
return platforms;
}
@@ -305,6 +304,7 @@ public:
platforms.emplace_back("Win32");
platforms.emplace_back("ARM");
platforms.emplace_back("ARM64");
+ platforms.emplace_back("ARM64EC");
return platforms;
}
@@ -369,6 +369,7 @@ public:
platforms.emplace_back("Win32");
platforms.emplace_back("ARM");
platforms.emplace_back("ARM64");
+ platforms.emplace_back("ARM64EC");
return platforms;
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index d2d34f9..c970abe 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1962,9 +1962,26 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
}
}
this->GetCMakeInstance()->AddCacheEntry(name, value, doc, type);
- if (this->GetPolicyStatus(cmPolicies::CMP0126) != cmPolicies::NEW) {
- // if there was a definition then remove it
- this->StateSnapshot.RemoveDefinition(name);
+ switch (this->GetPolicyStatus(cmPolicies::CMP0126)) {
+ case cmPolicies::WARN:
+ if (this->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0126") &&
+ this->IsNormalDefinitionSet(name)) {
+ this->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0126),
+ "\nFor compatibility with older versions of CMake, normal "
+ "variable \"",
+ name, "\" will be removed from the current scope."));
+ }
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ // if there was a definition then remove it
+ this->StateSnapshot.RemoveDefinition(name);
+ break;
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ break;
}
}
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index acdb09f..6950c19 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -71,7 +71,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
// CMAKE_PROJECT_NAME will match PROJECT_NAME, and cmake --build
// will work.
if (!mf.GetDefinition("CMAKE_PROJECT_NAME") || mf.IsRootMakefile()) {
- mf.AddDefinition("CMAKE_PROJECT_NAME", projectName);
+ mf.RemoveDefinition("CMAKE_PROJECT_NAME");
mf.AddCacheDefinition("CMAKE_PROJECT_NAME", projectName,
"Value Computed by CMake", cmStateEnums::STATIC);
}
@@ -395,7 +395,7 @@ static void TopLevelCMakeVarCondSet(cmMakefile& mf, std::string const& name,
// in the same CMakeLists.txt file, and it is the top level
// CMakeLists.txt file, then go with the last one.
if (!mf.GetDefinition(name) || mf.IsRootMakefile()) {
- mf.AddDefinition(name, value);
+ mf.RemoveDefinition(name);
mf.AddCacheDefinition(name, value, "Value Computed by CMake",
cmStateEnums::STATIC);
}
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
index aa8e21a..07ec4e3 100644
--- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@ -140,6 +140,8 @@ cmake_policy(PUSH)
cmake_policy(SET CMP0022 NEW)
cmake_policy(SET CMP0079 NEW)
add_executable(TopDir TopDir.c)
+add_library(TopDirInterface INTERFACE)
+target_link_libraries(TopDir PRIVATE TopDirInterface)
add_subdirectory(SubDirA)
add_subdirectory(SubDirB)
target_link_libraries(SubDirB TopDirImported)
diff --git a/Tests/CMakeCommands/target_link_libraries/SubDirA/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/SubDirA/CMakeLists.txt
index 4dae103..df7c483 100644
--- a/Tests/CMakeCommands/target_link_libraries/SubDirA/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/SubDirA/CMakeLists.txt
@@ -3,6 +3,8 @@ add_executable(SubDirA SubDirA.c)
# Link to a target imported in this directory that would not normally
# be visible to the directory in which TopDir is defined.
target_link_libraries(TopDir PUBLIC SameNameImported)
+# Do the same through an interface library in the top.
+target_link_libraries(TopDirInterface INTERFACE SameNameImported2)
# Link SubDirA to a target imported in this directory that has the same
# name as a target imported in SubDirB's directory. SubDirB will also
@@ -13,3 +15,5 @@ target_link_libraries(SubDirA PRIVATE SameNameImported)
# Distinguish this copy by having a unique usage requirement.
add_library(SameNameImported IMPORTED INTERFACE)
target_compile_definitions(SameNameImported INTERFACE DEF_SameNameImportedSubDirA)
+add_library(SameNameImported2 INTERFACE IMPORTED)
+target_compile_definitions(SameNameImported2 INTERFACE DEF_SameNameImported2SubDirA)
diff --git a/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt
index 06d1111..9af577c 100644
--- a/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt
@@ -3,6 +3,8 @@ add_executable(SubDirB SubDirB.c)
# Link to a target imported in this directory that would not normally
# be visible to the directory in which TopDir is defined.
target_link_libraries(TopDir PUBLIC debug SameNameImported optimized SameNameImported)
+# Do the same through an interface library in the top.
+target_link_libraries(TopDirInterface INTERFACE debug SameNameImported2 optimized SameNameImported2)
# Link to a list of targets imported in this directory that would not
# normally be visible to the directory in which TopDir is defined.
@@ -17,3 +19,5 @@ target_link_libraries(SubDirA PRIVATE SameNameImported)
# Distinguish this copy by having a unique usage requirement.
add_library(SameNameImported IMPORTED INTERFACE)
target_compile_definitions(SameNameImported INTERFACE DEF_SameNameImportedSubDirB)
+add_library(SameNameImported2 INTERFACE IMPORTED)
+target_compile_definitions(SameNameImported2 INTERFACE DEF_SameNameImported2SubDirB)
diff --git a/Tests/CMakeCommands/target_link_libraries/TopDir.c b/Tests/CMakeCommands/target_link_libraries/TopDir.c
index d8066e5..708b5c1 100644
--- a/Tests/CMakeCommands/target_link_libraries/TopDir.c
+++ b/Tests/CMakeCommands/target_link_libraries/TopDir.c
@@ -4,6 +4,12 @@
#ifndef DEF_SameNameImportedSubDirB
# error "DEF_SameNameImportedSubDirB is not defined but should be!"
#endif
+#ifndef DEF_SameNameImported2SubDirA
+# error "DEF_SameNameImported2SubDirA is not defined but should be!"
+#endif
+#ifndef DEF_SameNameImported2SubDirB
+# error "DEF_SameNameImported2SubDirB is not defined but should be!"
+#endif
#ifdef DEF_TopDirImported
# error "DEF_TopDirImported is defined but should not be!"
#endif
diff --git a/Tests/RunCMake/CMP0126/CMP0126-WARN-default.cmake b/Tests/RunCMake/CMP0126/CMP0126-WARN-default.cmake
new file mode 100644
index 0000000..3147fc4
--- /dev/null
+++ b/Tests/RunCMake/CMP0126/CMP0126-WARN-default.cmake
@@ -0,0 +1,3 @@
+
+set(MY_VAR 1)
+set(MY_VAR 2 CACHE STRING "")
diff --git a/Tests/RunCMake/CMP0126/CMP0126-WARN-stderr.txt b/Tests/RunCMake/CMP0126/CMP0126-WARN-stderr.txt
new file mode 100644
index 0000000..2301511
--- /dev/null
+++ b/Tests/RunCMake/CMP0126/CMP0126-WARN-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning \(dev\) at CMP0126-WARN.cmake:[0-9]+ \(set\):
+ Policy CMP0126 is not set: set\(CACHE\) does not remove a normal variable of
+ the same name\. Run "cmake --help-policy CMP0126" for policy details\. Use
+ the cmake_policy command to set the policy and suppress this warning\.
+
+ For compatibility with older versions of CMake, normal variable "MY_VAR"
+ will be removed from the current scope\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
diff --git a/Tests/RunCMake/CMP0126/CMP0126-WARN.cmake b/Tests/RunCMake/CMP0126/CMP0126-WARN.cmake
new file mode 100644
index 0000000..111c824
--- /dev/null
+++ b/Tests/RunCMake/CMP0126/CMP0126-WARN.cmake
@@ -0,0 +1,5 @@
+
+set(CMAKE_POLICY_WARNING_CMP0126 1)
+
+set(MY_VAR 1)
+set(MY_VAR 2 CACHE STRING "")
diff --git a/Tests/RunCMake/CMP0126/RunCMakeTest.cmake b/Tests/RunCMake/CMP0126/RunCMakeTest.cmake
index ae988f4..77c3878 100644
--- a/Tests/RunCMake/CMP0126/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0126/RunCMakeTest.cmake
@@ -4,3 +4,5 @@ run_cmake(CMP0126-OLD)
run_cmake_with_options(CMP0126-OLD_CL -DVAR=3)
run_cmake(CMP0126-NEW)
run_cmake_with_options(CMP0126-NEW_CL -DVAR=3)
+run_cmake(CMP0126-WARN)
+run_cmake(CMP0126-WARN-default)
diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake
index 61ce752..d1d615b 100644
--- a/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake
@@ -1,15 +1,13 @@
-execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --querytags
- OUTPUT_VARIABLE RPMBUILD_CAPS
- RESULT_VARIABLE RPMBUILD_CAPS_RESULT)
+# CPack uses `rpm --suggests` to check if rpmbuild supports the "Suggests:" tag.
+# This test intentionally uses a different method (build a test .spec) so any
+# problems will be caught early if functionality should change in the future.
+execute_process(
+ COMMAND ${RPMBUILD_EXECUTABLE} --nobuild test_suggests.spec
+ ERROR_QUIET
+ RESULT_VARIABLE RPMBUILD_SUGGESTS_RESULT)
-if(NOT RPMBUILD_CAPS_RESULT)
- string(REPLACE "\n" ";" RPMBUILD_CAPS "${RPMBUILD_CAPS}")
- cmake_policy(PUSH)
- cmake_policy(SET CMP0057 NEW)
- if(SUGGESTS IN_LIST RPMBUILD_CAPS)
- set(should_contain_suggests_tag_ true)
- endif()
- cmake_policy(POP)
+if(RPMBUILD_SUGGESTS_RESULT EQUAL 0)
+ set(should_contain_suggests_tag_ true)
endif()
# Only verify that suggests tag is present only if that tag is supported.
diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/test_suggests.spec b/Tests/RunCMake/CPack/tests/SUGGESTS/test_suggests.spec
new file mode 100644
index 0000000..e766fa9
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SUGGESTS/test_suggests.spec
@@ -0,0 +1,22 @@
+# This spec file is used to check if the provided version of rpmbuild supports the "Suggests:" tag
+
+Name: test
+Version: 0
+Release: 1
+Summary: test
+License: test
+
+Suggests: suggested_package
+
+%description
+
+
+%prep
+
+%build
+%configure
+%install
+%clean
+%files
+%doc
+%changelog