summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/if.rst23
-rw-r--r--Help/variable/MSVC_TOOLSET_VERSION.rst1
-rw-r--r--Modules/Platform/Windows-Clang.cmake1
-rw-r--r--Modules/Platform/Windows-Intel-C.cmake2
-rw-r--r--Modules/Platform/Windows-Intel-CXX.cmake2
-rw-r--r--Modules/Platform/Windows-IntelLLVM.cmake2
-rw-r--r--Source/cmExportFileGenerator.cxx5
-rw-r--r--Source/cmExportFileGenerator.h3
-rw-r--r--Source/cmExportInstallFileGenerator.cxx3
-rw-r--r--Source/cmFindCommon.cxx3
-rw-r--r--Source/cmFindPackageCommand.cxx67
-rw-r--r--Source/cmFindPackageCommand.h2
-rw-r--r--Source/cmInstallCommand.cxx2
-rw-r--r--Source/cmMakefile.cxx19
-rw-r--r--Source/cmMakefile.h14
-rw-r--r--Source/cmTarget.cxx16
-rw-r--r--Source/cmTarget.h7
-rw-r--r--Tests/RunCMake/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/Debug-stderr.txt3
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnv-stderr.txt100
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnv.cmake5
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stderr.txt101
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnvDebugPkg.cmake5
-rw-r--r--Tests/RunCMake/find_package/ModuleModeDebugPkg-stderr.txt128
-rw-r--r--Tests/RunCMake/find_package/ModuleModeDebugPkg.cmake2
-rw-r--r--Tests/RunCMake/find_package/ModuleModeDebugPkg/FindBar.cmake2
-rw-r--r--Tests/RunCMake/find_package/ModuleModeDebugPkg/FindFoo.cmake6
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/if/AndOr-stdout.txt1
-rw-r--r--Tests/RunCMake/if/AndOr.cmake6
-rw-r--r--Tests/RunCMake/if/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/install/EXPORT-TargetTwice-check.cmake19
-rw-r--r--Tests/RunCMake/install/EXPORT-TargetTwice-pkg1.txt5
-rw-r--r--Tests/RunCMake/install/EXPORT-TargetTwice-pkg2.txt5
-rw-r--r--Tests/RunCMake/install/EXPORT-TargetTwice.cmake17
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake1
36 files changed, 476 insertions, 113 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst
index a729b1e..4f955db 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -38,14 +38,21 @@ The following syntax applies to the ``condition`` argument of
the ``if``, ``elseif`` and :command:`while` clauses.
Compound conditions are evaluated in the following order of precedence:
-Innermost parentheses are evaluated first. Next come unary tests such
-as `EXISTS`_, `COMMAND`_, and `DEFINED`_. Then binary tests such as
-`EQUAL`_, `LESS`_, `LESS_EQUAL`_, `GREATER`_, `GREATER_EQUAL`_,
-`STREQUAL`_, `STRLESS`_, `STRLESS_EQUAL`_, `STRGREATER`_,
-`STRGREATER_EQUAL`_, `VERSION_EQUAL`_, `VERSION_LESS`_,
-`VERSION_LESS_EQUAL`_, `VERSION_GREATER`_, `VERSION_GREATER_EQUAL`_,
-and `MATCHES`_. Then the boolean operators in the order `NOT`_, `AND`_,
-and finally `OR`_.
+
+1. Parentheses.
+
+2. Unary tests such as `EXISTS`_, `COMMAND`_, and `DEFINED`_.
+
+3. Binary tests such as `EQUAL`_, `LESS`_, `LESS_EQUAL`_, `GREATER`_,
+ `GREATER_EQUAL`_, `STREQUAL`_, `STRLESS`_, `STRLESS_EQUAL`_,
+ `STRGREATER`_, `STRGREATER_EQUAL`_, `VERSION_EQUAL`_, `VERSION_LESS`_,
+ `VERSION_LESS_EQUAL`_, `VERSION_GREATER`_, `VERSION_GREATER_EQUAL`_,
+ and `MATCHES`_.
+
+4. Unary logical operator `NOT`_.
+
+5. Binary logical operators `AND`_ and `OR`_, from left to right,
+ without any short-circuit.
Basic Expressions
"""""""""""""""""
diff --git a/Help/variable/MSVC_TOOLSET_VERSION.rst b/Help/variable/MSVC_TOOLSET_VERSION.rst
index c642a9f..59479af 100644
--- a/Help/variable/MSVC_TOOLSET_VERSION.rst
+++ b/Help/variable/MSVC_TOOLSET_VERSION.rst
@@ -17,6 +17,7 @@ Known toolset version numbers are::
140 = VS 2015 (14.0)
141 = VS 2017 (15.0)
142 = VS 2019 (16.0)
+ 143 = VS 2022 (17.0)
Compiler versions newer than those known to CMake will be reported
as the latest known toolset version.
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index c4d6fd8..e7e975d 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -101,6 +101,7 @@ macro(__windows_compiler_clang_gnu lang)
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG -Xclang -gcodeview ${__ADDED_FLAGS}")
endif()
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
+ set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON)
set(CMAKE_PCH_EXTENSION .pch)
set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake
index 152b27c..e4d9b93 100644
--- a/Modules/Platform/Windows-Intel-C.cmake
+++ b/Modules/Platform/Windows-Intel-C.cmake
@@ -1,7 +1,7 @@
include(Platform/Windows-Intel)
__windows_compiler_intel(C)
-set(CMAKE_DEPFILE_FLAGS_C "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
+set(CMAKE_DEPFILE_FLAGS_C "-QMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
set(CMAKE_C_DEPFILE_FORMAT gcc)
if(CMAKE_GENERATOR MATCHES "^Ninja")
diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake
index ce33ae1..6adbb6e 100644
--- a/Modules/Platform/Windows-Intel-CXX.cmake
+++ b/Modules/Platform/Windows-Intel-CXX.cmake
@@ -2,7 +2,7 @@ include(Platform/Windows-Intel)
set(_COMPILE_CXX " /TP")
__windows_compiler_intel(CXX)
-set(CMAKE_DEPFILE_FLAGS_CXX "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
+set(CMAKE_DEPFILE_FLAGS_CXX "-QMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
set(CMAKE_CXX_DEPFILE_FORMAT gcc)
if(CMAKE_GENERATOR MATCHES "^Ninja")
diff --git a/Modules/Platform/Windows-IntelLLVM.cmake b/Modules/Platform/Windows-IntelLLVM.cmake
index 4687bee..f24dcdb 100644
--- a/Modules/Platform/Windows-IntelLLVM.cmake
+++ b/Modules/Platform/Windows-IntelLLVM.cmake
@@ -25,6 +25,6 @@ macro(__windows_compiler_intel lang)
"<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <CMAKE_${lang}_LINK_FLAGS> <OBJECTS> ${CMAKE_START_TEMP_FILE} -fuse-ld=llvm-lib -o <TARGET> -link <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
endif()
- set(CMAKE_DEPFILE_FLAGS_${lang} "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-QMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
set(CMAKE_${lang}_DEPFILE_FORMAT gcc)
endmacro()
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 2d80f0e..b46b933 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -375,7 +375,8 @@ void cmExportFileGenerator::PopulateSourcesInterface(
void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
- ImportPropertyMap& properties, std::vector<std::string>& missingTargets)
+ ImportPropertyMap& properties, std::vector<std::string>& missingTargets,
+ cmTargetExport const& te)
{
assert(preprocessRule == cmGeneratorExpression::InstallInterface);
@@ -385,7 +386,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
cmGeneratorExpression ge;
std::string dirs = cmGeneratorExpression::Preprocess(
- cmJoin(target->Target->GetInstallIncludeDirectoriesEntries(), ";"),
+ cmJoin(target->Target->GetInstallIncludeDirectoriesEntries(te), ";"),
preprocessRule, true);
this->ReplaceInstallPrefix(dirs);
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 5875247..d50f7e8 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -148,7 +148,8 @@ protected:
void PopulateIncludeDirectoriesInterface(
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
- ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
+ ImportPropertyMap& properties, std::vector<std::string>& missingTargets,
+ cmTargetExport const& te);
void PopulateSourcesInterface(
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 2dd8b8f..f232440 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -90,7 +90,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
ImportPropertyMap properties;
this->PopulateIncludeDirectoriesInterface(
- gt, cmGeneratorExpression::InstallInterface, properties, missingTargets);
+ gt, cmGeneratorExpression::InstallInterface, properties, missingTargets,
+ *te);
this->PopulateSourcesInterface(gt, cmGeneratorExpression::InstallInterface,
properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", gt,
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 1bb98ea..7106e4b 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -73,7 +73,8 @@ void cmFindCommon::DebugMessage(std::string const& msg) const
bool cmFindCommon::ComputeIfDebugModeWanted()
{
- return this->Makefile->IsOn("CMAKE_FIND_DEBUG_MODE") ||
+ return this->Makefile->GetDebugFindPkgMode() ||
+ this->Makefile->IsOn("CMAKE_FIND_DEBUG_MODE") ||
this->Makefile->GetCMakeInstance()->GetDebugFindOutput();
}
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index fac0e08..f55d838 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -33,7 +33,6 @@
#include "cmSystemTools.h"
#include "cmValue.h"
#include "cmVersion.h"
-#include "cmake.h"
#if defined(__HAIKU__)
# include <FindDirectory.h>
@@ -235,8 +234,8 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
this->SearchPathSuffixes.emplace_back();
// Process debug mode
- this->DebugMode = this->ComputeIfDebugModeWanted(this->Name);
- this->DebugBuffer.clear();
+ cmMakefile::DebugFindPkgRAII debugFindPkgRAII(this->Makefile, this->Name);
+ this->DebugMode = this->ComputeIfDebugModeWanted();
// Parse the arguments.
enum Doing
@@ -609,22 +608,15 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
loadedPackage = true;
}
}
-
- if (this->DebugMode) {
- this->DebugMessage(this->DebugBuffer);
- this->DebugBuffer.clear();
- }
}
this->AppendSuccessInformation();
- return loadedPackage;
-}
+ if (!this->DebugBuffer.empty()) {
+ this->DebugMessage(this->DebugBuffer);
+ }
-bool cmFindPackageCommand::ComputeIfDebugModeWanted(std::string const& var)
-{
- return this->ComputeIfDebugModeWanted() ||
- this->Makefile->GetCMakeInstance()->GetDebugFindPkgOutput(var);
+ return loadedPackage;
}
bool cmFindPackageCommand::FindPackageUsingModuleMode()
@@ -794,22 +786,21 @@ void cmFindPackageCommand::RestoreFindDefinitions()
bool cmFindPackageCommand::FindModule(bool& found)
{
- std::string module = cmStrCat("Find", this->Name, ".cmake");
+ std::string moduleFileName = cmStrCat("Find", this->Name, ".cmake");
bool system = false;
- std::string debugBuffer =
- cmStrCat("find_package considered the following paths for ", this->Name,
- ".cmake\n");
+ std::string debugBuffer = cmStrCat(
+ "find_package considered the following paths for ", moduleFileName, ":\n");
std::string mfile = this->Makefile->GetModulesFile(
- module, system, this->DebugMode, debugBuffer);
+ moduleFileName, system, this->DebugMode, debugBuffer);
if (this->DebugMode) {
if (mfile.empty()) {
- debugBuffer = cmStrCat(debugBuffer, "The file was not found.");
+ debugBuffer = cmStrCat(debugBuffer, "The file was not found.\n");
} else {
debugBuffer =
cmStrCat(debugBuffer, "The file was found at\n ", mfile, "\n");
}
- this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer);
}
if (!mfile.empty()) {
@@ -953,11 +944,6 @@ bool cmFindPackageCommand::HandlePackageMode(
result = false;
}
- if (this->DebugMode) {
- this->DebugMessage(this->DebugBuffer);
- this->DebugBuffer.clear();
- }
-
// package not found
if (result && !found) {
// warn if package required or neither quiet nor in config mode
@@ -1123,7 +1109,8 @@ bool cmFindPackageCommand::FindConfig()
if (this->DebugMode) {
this->DebugBuffer = cmStrCat(this->DebugBuffer,
"find_package considered the following "
- "locations for the Config module:\n");
+ "locations for ",
+ this->Name, "'s Config module:\n");
}
// Search for frameworks.
@@ -1315,7 +1302,7 @@ inline std::size_t collectPathsForDebug(std::string& buffer,
{
const auto& paths = searchPath.GetPaths();
if (paths.empty()) {
- buffer += " none";
+ buffer += " none\n";
return 0;
}
for (std::size_t i = startIndex; i < paths.size(); i++) {
@@ -1375,7 +1362,7 @@ void cmFindPackageCommand::FillPrefixesPackageRoot()
std::string debugBuffer = "<PackageName>_ROOT CMake variable "
"[CMAKE_FIND_USE_PACKAGE_ROOT_PATH].\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer);
}
}
@@ -1398,7 +1385,7 @@ void cmFindPackageCommand::FillPrefixesCMakeEnvironment()
paths.AddEnvPath("CMAKE_PREFIX_PATH");
if (this->DebugMode) {
debugBuffer = cmStrCat(debugBuffer,
- "\nCMAKE_PREFIX_PATH env variable "
+ "CMAKE_PREFIX_PATH env variable "
"[CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH].\n");
debugOffset = collectPathsForDebug(debugBuffer, paths, debugOffset);
}
@@ -1408,10 +1395,10 @@ void cmFindPackageCommand::FillPrefixesCMakeEnvironment()
if (this->DebugMode) {
debugBuffer =
cmStrCat(debugBuffer,
- "\nCMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH env "
+ "CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH env "
"variables [CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH].\n");
collectPathsForDebug(debugBuffer, paths, debugOffset);
- this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer);
}
}
@@ -1432,10 +1419,10 @@ void cmFindPackageCommand::FillPrefixesCMakeVariable()
if (this->DebugMode) {
debugBuffer =
cmStrCat(debugBuffer,
- "\nCMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables "
+ "CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables "
"[CMAKE_FIND_USE_CMAKE_PATH].\n");
collectPathsForDebug(debugBuffer, paths, debugOffset);
- this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer);
}
}
@@ -1460,7 +1447,7 @@ void cmFindPackageCommand::FillPrefixesSystemEnvironment()
std::string debugBuffer = "Standard system environment variables "
"[CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH].\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer);
}
}
@@ -1490,7 +1477,7 @@ void cmFindPackageCommand::FillPrefixesUserRegistry()
"CMake User Package Registry [CMAKE_FIND_USE_PACKAGE_REGISTRY].\n";
collectPathsForDebug(debugBuffer,
this->LabeledPaths[PathLabel::UserRegistry]);
- this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer);
}
}
@@ -1510,7 +1497,7 @@ void cmFindPackageCommand::FillPrefixesSystemRegistry()
"[CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY].\n";
collectPathsForDebug(debugBuffer,
this->LabeledPaths[PathLabel::SystemRegistry]);
- this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer);
}
}
@@ -1689,7 +1676,7 @@ void cmFindPackageCommand::FillPrefixesCMakeSystemVariable()
std::string debugBuffer = "CMake variables defined in the Platform file "
"[CMAKE_FIND_USE_CMAKE_SYSTEM_PATH].\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer);
}
}
@@ -1704,7 +1691,7 @@ void cmFindPackageCommand::FillPrefixesUserGuess()
std::string debugBuffer =
"Paths specified by the find_package PATHS option.\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer);
}
}
@@ -1719,7 +1706,7 @@ void cmFindPackageCommand::FillPrefixesUserHints()
std::string debugBuffer =
"Paths specified by the find_package HINTS option.\n";
collectPathsForDebug(debugBuffer, paths);
- this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer, "\n");
+ this->DebugBuffer = cmStrCat(this->DebugBuffer, debugBuffer);
}
}
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 439d934..f921bb0 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -40,7 +40,6 @@ class cmSearchPath;
class cmFindPackageCommand : public cmFindCommon
{
public:
- using cmFindCommon::ComputeIfDebugModeWanted;
/*! A sorting order strategy to be applied to recovered package folders (see
* FIND_PACKAGE_SORT_ORDER)*/
enum /*class*/ SortOrderType
@@ -121,7 +120,6 @@ private:
bool ReadListFile(const std::string& f, PolicyScopeRule psr);
void StoreVersionFound();
- bool ComputeIfDebugModeWanted(std::string const& var);
void ComputePrefixes();
void FillPrefixesPackageRoot();
void FillPrefixesCMakeEnvironment();
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 52a411b..a77b26b 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -760,7 +760,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
te->FileSetGenerators[gen->GetFileSet()] = gen.get();
}
target.AddInstallIncludeDirectories(
- cmMakeRange(includesArgs.GetIncludeDirs()));
+ *te, cmMakeRange(includesArgs.GetIncludeDirs()));
te->NamelinkOnly = namelinkOnly;
helper.Makefile->GetGlobalGenerator()
->GetExportSets()[exports]
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 68e61bb..94d3be6 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4519,3 +4519,22 @@ cmMakefile::MacroPushPop::~MacroPushPop()
{
this->Makefile->PopMacroScope(this->ReportError);
}
+
+cmMakefile::DebugFindPkgRAII::DebugFindPkgRAII(cmMakefile* mf,
+ std::string const& pkg)
+ : Makefile(mf)
+ , OldValue(this->Makefile->DebugFindPkg)
+{
+ this->Makefile->DebugFindPkg =
+ this->Makefile->GetCMakeInstance()->GetDebugFindPkgOutput(pkg);
+}
+
+cmMakefile::DebugFindPkgRAII::~DebugFindPkgRAII()
+{
+ this->Makefile->DebugFindPkg = this->OldValue;
+}
+
+bool cmMakefile::GetDebugFindPkgMode() const
+{
+ return this->DebugFindPkg;
+}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 85988b8..f425697 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -931,6 +931,18 @@ public:
// searches
std::deque<std::vector<std::string>> FindPackageRootPathStack;
+ class DebugFindPkgRAII
+ {
+ cmMakefile* Makefile;
+ bool OldValue;
+
+ public:
+ DebugFindPkgRAII(cmMakefile* mf, std::string const& pkg);
+ ~DebugFindPkgRAII();
+ };
+
+ bool GetDebugFindPkgMode() const;
+
void MaybeWarnCMP0074(std::string const& pkg);
void MaybeWarnUninitialized(std::string const& variable,
const char* sourceFilename) const;
@@ -1104,6 +1116,8 @@ private:
std::vector<BT<GeneratorAction>> GeneratorActions;
bool GeneratorActionsInvoked = false;
+ bool DebugFindPkg = false;
+
bool CheckSystemVars;
bool CheckCMP0000;
std::set<std::string> WarnedCMP0074;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 87fce92..6059055 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -192,7 +192,8 @@ public:
cmTarget::LinkLibraryVectorType OriginalLinkLibraries;
std::map<std::string, BTs<std::string>> LanguageStandardProperties;
std::vector<BT<std::string>> IncludeDirectoriesEntries;
- std::vector<std::string> InstallIncludeDirectoriesEntries;
+ std::map<cmTargetExport const*, std::vector<std::string>>
+ InstallIncludeDirectoriesEntries;
std::vector<BT<std::string>> CompileOptionsEntries;
std::vector<BT<std::string>> CompileFeaturesEntries;
std::vector<BT<std::string>> CompileDefinitionsEntries;
@@ -1079,15 +1080,18 @@ std::set<std::string> const& cmTarget::GetSystemIncludeDirectories() const
return this->impl->SystemIncludeDirectories;
}
-void cmTarget::AddInstallIncludeDirectories(cmStringRange const& incs)
+void cmTarget::AddInstallIncludeDirectories(cmTargetExport const& te,
+ cmStringRange const& incs)
{
- std::copy(incs.begin(), incs.end(),
- std::back_inserter(this->impl->InstallIncludeDirectoriesEntries));
+ std::copy(
+ incs.begin(), incs.end(),
+ std::back_inserter(this->impl->InstallIncludeDirectoriesEntries[&te]));
}
-cmStringRange cmTarget::GetInstallIncludeDirectoriesEntries() const
+cmStringRange cmTarget::GetInstallIncludeDirectoriesEntries(
+ cmTargetExport const& te) const
{
- return cmMakeRange(this->impl->InstallIncludeDirectoriesEntries);
+ return cmMakeRange(this->impl->InstallIncludeDirectoriesEntries[&te]);
}
cmBTStringRange cmTarget::GetIncludeDirectoriesEntries() const
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 18e39c7..0cdd2fc 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -27,6 +27,7 @@ class cmListFileContext;
class cmMakefile;
class cmPropertyMap;
class cmSourceFile;
+class cmTargetExport;
class cmTargetInternals;
template <typename T>
@@ -237,8 +238,10 @@ public:
void AddSystemIncludeDirectories(std::set<std::string> const& incs);
std::set<std::string> const& GetSystemIncludeDirectories() const;
- void AddInstallIncludeDirectories(cmStringRange const& incs);
- cmStringRange GetInstallIncludeDirectoriesEntries() const;
+ void AddInstallIncludeDirectories(cmTargetExport const& te,
+ cmStringRange const& incs);
+ cmStringRange GetInstallIncludeDirectoriesEntries(
+ cmTargetExport const& te) const;
BTs<std::string> const* GetLanguageStandardProperty(
const std::string& propertyName) const;
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 1d7e632..6087021 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -84,7 +84,8 @@ endif()
# Test MSVC for older host CMake versions, and test
# WIN32/CMAKE_C_COMPILER_ID to fix check on Intel for Windows.
-if(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel"))
+if(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel")
+ OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_C_SIMULATE_ID MATCHES "MSVC"))
set(LINKER_SUPPORTS_PDB 1)
else()
set(LINKER_SUPPORTS_PDB 0)
diff --git a/Tests/RunCMake/CMakePresets/Debug-stderr.txt b/Tests/RunCMake/CMakePresets/Debug-stderr.txt
index 7fdb8b3..d30dc58 100644
--- a/Tests/RunCMake/CMakePresets/Debug-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/Debug-stderr.txt
@@ -1 +1,2 @@
- find_package considered the following locations for the Config module:
+ find_package considered the following locations for
+ ThisPackageHopefullyDoesNotExist's Config module:
diff --git a/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt b/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
index b35f05e..691d7f0 100644
--- a/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
+++ b/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
@@ -1,20 +1,80 @@
-CMake Debug Log at FromPATHEnv.cmake:5 \(find_package\):
- find_package considered the following paths for Resolved.cmake.*
-.*/Modules/FindResolved.cmake.*
- The file was not found.*
- <PackageName>_ROOT CMake variable.*
- CMAKE_PREFIX_PATH variable.*
- CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables.*
- Env variable Resolved_DIR.*
- CMAKE_PREFIX_PATH env variable.*
- Paths specified by the find_package HINTS option.*
- Standard system environment variables.*
-.*Tests/RunCMake/find_package/PackageRoot.*
- CMake User Package Registry.*
- CMake variables defined in the Platform file.*
- CMake System Package Registry.*
- Paths specified by the find_package PATHS option.*
- find_package considered the following locations for the Config module:.*
-.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake.*
- The file was found at.*
-.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake
+^CMake Debug Log at FromPATHEnv.cmake:[0-9]+ \(find_package\):
+ find_package considered the following paths for FindResolved.cmake:
+
+ [^
+]*/Modules/FindResolved.cmake
+
+ The file was not found.
+
+ <PackageName>_ROOT CMake variable \[CMAKE_FIND_USE_PACKAGE_ROOT_PATH\].
+
+ none
+
+ CMAKE_PREFIX_PATH variable \[CMAKE_FIND_USE_CMAKE_PATH\].
+
+ none
+
+ CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables
+ \[CMAKE_FIND_USE_CMAKE_PATH\].
+
+ none
+
+ Env variable Resolved_DIR \[CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH\].
+
+ none
+
+ CMAKE_PREFIX_PATH env variable \[CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH\].
+(
+ [^
+]+)+
+
+ CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH env variables
+ \[CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH\].
+(
+ [^
+]+)+
+
+ Paths specified by the find_package HINTS option.
+
+ none
+
+ Standard system environment variables
+ \[CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH\].
+
+ [^
+]*/Tests/RunCMake/find_package/PackageRoot
+
+ CMake User Package Registry \[CMAKE_FIND_USE_PACKAGE_REGISTRY\].
+(
+ [^
+]+)+
+
+ CMake variables defined in the Platform file
+ \[CMAKE_FIND_USE_CMAKE_SYSTEM_PATH\].
+(
+ [^
+]+)+
+
+ CMake System Package Registry
+ \[CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY\].
+(
+ [^
+]+)+
+
+ Paths specified by the find_package PATHS option.
+
+ none
+
+ find_package considered the following locations for Resolved's Config
+ module:
+
+ [^
+]*/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake
+
+ The file was found at
+
+ [^
+]*/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/find_package/FromPATHEnv.cmake b/Tests/RunCMake/find_package/FromPATHEnv.cmake
index ceb79b6..9158d4b 100644
--- a/Tests/RunCMake/find_package/FromPATHEnv.cmake
+++ b/Tests/RunCMake/find_package/FromPATHEnv.cmake
@@ -1,4 +1,7 @@
set(ENV_PATH "$ENV{PATH}")
+set(ENV_CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
+
+set(ENV{CMAKE_PREFIX_PATH} "")
set(CMAKE_FIND_DEBUG_MODE ON)
set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot")
@@ -30,4 +33,6 @@ foreach(path "/does_not_exist" "/PackageRoot" "")
find_package(Resolved NO_SYSTEM_ENVIRONMENT_PATH QUIET)
message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
endforeach()
+
+set(ENV{CMAKE_PREFIX_PATH} "${ENV_CMAKE_PREFIX_PATH}")
set(ENV{PATH} "${ENV_PATH}")
diff --git a/Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stderr.txt b/Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stderr.txt
index 94ed178..ef5ec33 100644
--- a/Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stderr.txt
+++ b/Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stderr.txt
@@ -1,21 +1,80 @@
-CMake Debug Log at FromPATHEnvDebugPkg.cmake:4 \(find_package\):
- find_package considered the following paths for Resolved.cmake.*
-.*/Modules/FindResolved.cmake.*
- The file was not found.*
- <PackageName>_ROOT CMake variable.*
- CMAKE_PREFIX_PATH variable.*
- CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables.*
- Env variable Resolved_DIR.*
- CMAKE_PREFIX_PATH env variable.*
- CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH env variables.*
- Paths specified by the find_package HINTS option.*
- Standard system environment variables.*
-.*Tests/RunCMake/find_package/PackageRoot.*
- CMake User Package Registry.*
- CMake variables defined in the Platform file.*
- CMake System Package Registry.*
- Paths specified by the find_package PATHS option.*
- find_package considered the following locations for the Config module:.*
-.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake.*
- The file was found at.*
-.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake
+^CMake Debug Log at FromPATHEnvDebugPkg.cmake:[0-9]+ \(find_package\):
+ find_package considered the following paths for FindResolved.cmake:
+
+ [^
+]*/Modules/FindResolved.cmake
+
+ The file was not found.
+
+ <PackageName>_ROOT CMake variable \[CMAKE_FIND_USE_PACKAGE_ROOT_PATH\].
+
+ none
+
+ CMAKE_PREFIX_PATH variable \[CMAKE_FIND_USE_CMAKE_PATH\].
+
+ none
+
+ CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables
+ \[CMAKE_FIND_USE_CMAKE_PATH\].
+
+ none
+
+ Env variable Resolved_DIR \[CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH\].
+
+ none
+
+ CMAKE_PREFIX_PATH env variable \[CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH\].
+(
+ [^
+]+)+
+
+ CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH env variables
+ \[CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH\].
+(
+ [^
+]+)+
+
+ Paths specified by the find_package HINTS option.
+
+ none
+
+ Standard system environment variables
+ \[CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH\].
+
+ [^
+]*/Tests/RunCMake/find_package/PackageRoot
+
+ CMake User Package Registry \[CMAKE_FIND_USE_PACKAGE_REGISTRY\].
+(
+ [^
+]+)+
+
+ CMake variables defined in the Platform file
+ \[CMAKE_FIND_USE_CMAKE_SYSTEM_PATH\].
+(
+ [^
+]+)+
+
+ CMake System Package Registry
+ \[CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY\].
+(
+ [^
+]+)+
+
+ Paths specified by the find_package PATHS option.
+
+ none
+
+ find_package considered the following locations for Resolved's Config
+ module:
+
+ [^
+]*/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake
+
+ The file was found at
+
+ [^
+]*/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/find_package/FromPATHEnvDebugPkg.cmake b/Tests/RunCMake/find_package/FromPATHEnvDebugPkg.cmake
index 0ed8a12..72b03e6 100644
--- a/Tests/RunCMake/find_package/FromPATHEnvDebugPkg.cmake
+++ b/Tests/RunCMake/find_package/FromPATHEnvDebugPkg.cmake
@@ -1,4 +1,7 @@
set(ENV_PATH "$ENV{PATH}")
+set(ENV_CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
+
+set(ENV{CMAKE_PREFIX_PATH} "")
set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot")
find_package(Resolved QUIET)
@@ -28,4 +31,6 @@ foreach(path "/does_not_exist" "/PackageRoot" "")
find_package(ResolvedC NO_SYSTEM_ENVIRONMENT_PATH QUIET)
message(STATUS "Resolved_FOUND='${ResolvedC_FOUND}'")
endforeach()
+
+set(ENV{CMAKE_PREFIX_PATH} "${ENV_CMAKE_PREFIX_PATH}")
set(ENV{PATH} "${ENV_PATH}")
diff --git a/Tests/RunCMake/find_package/ModuleModeDebugPkg-stderr.txt b/Tests/RunCMake/find_package/ModuleModeDebugPkg-stderr.txt
new file mode 100644
index 0000000..e4fd7c5
--- /dev/null
+++ b/Tests/RunCMake/find_package/ModuleModeDebugPkg-stderr.txt
@@ -0,0 +1,128 @@
+^CMake Debug Log at ModuleModeDebugPkg/FindFoo.cmake:[0-9]+ \(find_program\):
+ find_program called with the following settings:
+
+ VAR: FOO_EXE
+ NAMES: "ModuleModeDebugPkgFooExe"
+ Documentation: Path to a program.
+ Framework
+ Only Search Frameworks: 0
+ Search Frameworks Last: 0
+ Search Frameworks First: [01]
+ AppBundle
+ Only Search AppBundle: 0
+ Search AppBundle Last: 0
+ Search AppBundle First: [01]
+ NO_DEFAULT_PATH Enabled
+
+ find_program considered the following locations:
+
+ The item was not found.
+
+Call Stack \(most recent call first\):
+ ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Debug Log at ModuleModeDebugPkg/FindFoo.cmake:[0-9]+ \(find_library\):
+ find_library called with the following settings:
+
+ VAR: FOO_LIB
+ NAMES: "ModuleModeDebugPkgFooLib"
+ Documentation: Path to a library.
+ Framework
+ Only Search Frameworks: 0
+ Search Frameworks Last: 0
+ Search Frameworks First: [01]
+ AppBundle
+ Only Search AppBundle: 0
+ Search AppBundle Last: 0
+ Search AppBundle First: [01]
+ NO_DEFAULT_PATH Enabled
+
+ find_library considered the following locations:
+
+ The item was not found.
+
+Call Stack \(most recent call first\):
+ ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Debug Log at ModuleModeDebugPkg/FindFoo.cmake:[0-9]+ \(find_path\):
+ find_path called with the following settings:
+
+ VAR: FOO_PATH
+ NAMES: "ModuleModeDebugPkgFoo.h"
+ Documentation: Path to a file.
+ Framework
+ Only Search Frameworks: 0
+ Search Frameworks Last: 0
+ Search Frameworks First: [01]
+ AppBundle
+ Only Search AppBundle: 0
+ Search AppBundle Last: 0
+ Search AppBundle First: [01]
+ NO_DEFAULT_PATH Enabled
+
+ find_path considered the following locations:
+
+ The item was not found.
+
+Call Stack \(most recent call first\):
+ ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Debug Log at ModuleModeDebugPkg/FindFoo.cmake:[0-9]+ \(find_file\):
+ find_file called with the following settings:
+
+ VAR: FOO_FILE
+ NAMES: "ModuleModeDebugPkgFoo.h"
+ Documentation: Path to a file.
+ Framework
+ Only Search Frameworks: 0
+ Search Frameworks Last: 0
+ Search Frameworks First: [01]
+ AppBundle
+ Only Search AppBundle: 0
+ Search AppBundle Last: 0
+ Search AppBundle First: [01]
+ NO_DEFAULT_PATH Enabled
+
+ find_file considered the following locations:
+
+ The item was not found.
+
+Call Stack \(most recent call first\):
+ ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
++
+FindBar processed here.
++
+CMake Debug Log at ModuleModeDebugPkg/FindFoo.cmake:[0-9]+ \(find_package\):
+ Paths specified by the find_package HINTS option.
+
+ none
+
+ Paths specified by the find_package PATHS option.
+
+ none
+
+ find_package considered the following locations for Zot's Config module:
+
+ The file was not found.
+
+Call Stack \(most recent call first\):
+ ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Debug Log at ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\):
+ find_package considered the following paths for FindFoo.cmake:
+
+ [^
+]*/Modules/FindFoo.cmake
+
+ The file was found at
+
+ [^
+]*/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindFoo.cmake
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/find_package/ModuleModeDebugPkg.cmake b/Tests/RunCMake/find_package/ModuleModeDebugPkg.cmake
new file mode 100644
index 0000000..d9cac09
--- /dev/null
+++ b/Tests/RunCMake/find_package/ModuleModeDebugPkg.cmake
@@ -0,0 +1,2 @@
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/ModuleModeDebugPkg)
+find_package(Foo)
diff --git a/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindBar.cmake b/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindBar.cmake
new file mode 100644
index 0000000..0711118
--- /dev/null
+++ b/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindBar.cmake
@@ -0,0 +1,2 @@
+message("FindBar processed here.\n")
+find_program(BAR_EXE NAMES ModuleModeDebugPkgBarExe NO_DEFAULT_PATH)
diff --git a/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindFoo.cmake b/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindFoo.cmake
new file mode 100644
index 0000000..23a15b4
--- /dev/null
+++ b/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindFoo.cmake
@@ -0,0 +1,6 @@
+find_program(FOO_EXE NAMES ModuleModeDebugPkgFooExe NO_DEFAULT_PATH)
+find_library(FOO_LIB NAMES ModuleModeDebugPkgFooLib NO_DEFAULT_PATH)
+find_path(FOO_PATH NAMES ModuleModeDebugPkgFoo.h NO_DEFAULT_PATH)
+find_file(FOO_FILE NAMES ModuleModeDebugPkgFoo.h NO_DEFAULT_PATH)
+find_package(Bar) # not included
+find_package(Zot NO_MODULE NO_DEFAULT_PATH) # is included
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 037502f..5f4c6cb 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -4,6 +4,7 @@ run_cmake(CMP0074-WARN)
run_cmake(CMP0074-OLD)
run_cmake(ComponentRequiredAndOptional)
run_cmake(FromPATHEnv)
+run_cmake_with_options(FromPATHEnvDebugPkg --debug-find-pkg=Resolved)
run_cmake(FromPrefixPath)
run_cmake(MissingNormal)
run_cmake(MissingNormalForceRequired)
@@ -15,10 +16,12 @@ run_cmake(MissingModule)
run_cmake(MissingModuleRequired)
run_cmake(MissingConfig)
run_cmake(MissingConfigDebug)
+run_cmake_with_options(MissingConfigDebugPkg --debug-find-pkg=NotHere)
run_cmake(MissingConfigOneName)
run_cmake(MissingConfigRequired)
run_cmake(MissingConfigVersion)
run_cmake(MixedModeOptions)
+run_cmake_with_options(ModuleModeDebugPkg --debug-find-pkg=Foo,Zot)
run_cmake(PackageRoot)
run_cmake(PackageRootNestedConfig)
run_cmake(PackageRootNestedModule)
@@ -51,6 +54,3 @@ if(UNIX
)
run_cmake(SetFoundResolved)
endif()
-
-run_cmake_with_options(MissingConfigDebugPkg --debug-find-pkg=NotHere)
-run_cmake_with_options(FromPATHEnvDebugPkg --debug-find-pkg=Resolved)
diff --git a/Tests/RunCMake/if/AndOr-stdout.txt b/Tests/RunCMake/if/AndOr-stdout.txt
new file mode 100644
index 0000000..9fd395b
--- /dev/null
+++ b/Tests/RunCMake/if/AndOr-stdout.txt
@@ -0,0 +1 @@
+-- OR and AND correctly evaluated left to right
diff --git a/Tests/RunCMake/if/AndOr.cmake b/Tests/RunCMake/if/AndOr.cmake
new file mode 100644
index 0000000..847d6f2
--- /dev/null
+++ b/Tests/RunCMake/if/AndOr.cmake
@@ -0,0 +1,6 @@
+# AND and OR are the same precedence
+if(1 OR 0 AND 0) # equivalent to ((1 OR 0) AND 0)
+ message(FATAL_ERROR "AND incorrectly evaluated before OR")
+else()
+ message(STATUS "OR and AND correctly evaluated left to right")
+endif()
diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake
index 6baa840..de9cb57 100644
--- a/Tests/RunCMake/if/RunCMakeTest.cmake
+++ b/Tests/RunCMake/if/RunCMakeTest.cmake
@@ -17,3 +17,5 @@ run_cmake(IncompleteMatchesFail)
run_cmake(TestNameThatExists)
run_cmake(TestNameThatDoesNotExist)
+
+run_cmake_script(AndOr)
diff --git a/Tests/RunCMake/install/EXPORT-TargetTwice-check.cmake b/Tests/RunCMake/install/EXPORT-TargetTwice-check.cmake
new file mode 100644
index 0000000..97677ca
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-TargetTwice-check.cmake
@@ -0,0 +1,19 @@
+set(pkg1_cmake "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/pkg1/pkg1.cmake")
+file(STRINGS "${pkg1_cmake}" pkg1_includes REGEX INTERFACE_INCLUDE_DIRECTORIES)
+set(pkg1_expect [[INTERFACE_INCLUDE_DIRECTORIES "\${_IMPORT_PREFIX}/pkg1/inc"]])
+if(NOT pkg1_includes MATCHES "${pkg1_expect}")
+ set(RunCMake_TEST_FAILED "pkg1 has unexpected INTERFACE_INCLUDE_DIRECTORIES line:
+ ${pkg1_includes}
+It does not match:
+ ${pkg1_expect}")
+endif()
+
+set(pkg2_cmake "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/pkg2/pkg2.cmake")
+file(STRINGS "${pkg2_cmake}" pkg2_includes REGEX INTERFACE_INCLUDE_DIRECTORIES)
+set(pkg2_expect [[INTERFACE_INCLUDE_DIRECTORIES "\${_IMPORT_PREFIX}/pkg2/inc"]])
+if(NOT pkg2_includes MATCHES "${pkg2_expect}")
+ set(RunCMake_TEST_FAILED "pkg2 has unexpected INTERFACE_INCLUDE_DIRECTORIES line:
+ ${pkg2_includes}
+It does not match:
+ ${pkg2_expect}")
+endif()
diff --git a/Tests/RunCMake/install/EXPORT-TargetTwice-pkg1.txt b/Tests/RunCMake/install/EXPORT-TargetTwice-pkg1.txt
new file mode 100644
index 0000000..592f79c
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-TargetTwice-pkg1.txt
@@ -0,0 +1,5 @@
+.+
+set_target_properties\(pkg1::foo PROPERTIES
+.+INTERFACE_INCLUDE_DIRECTORIES "\${_IMPORT_PREFIX}/pkg1/inc"
+\)
+.+
diff --git a/Tests/RunCMake/install/EXPORT-TargetTwice-pkg2.txt b/Tests/RunCMake/install/EXPORT-TargetTwice-pkg2.txt
new file mode 100644
index 0000000..ebfc43e
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-TargetTwice-pkg2.txt
@@ -0,0 +1,5 @@
+.+
+set_target_properties\(pkg2::foo PROPERTIES
+.+INTERFACE_INCLUDE_DIRECTORIES "\${_IMPORT_PREFIX}/pkg2/inc"
+\)
+.+
diff --git a/Tests/RunCMake/install/EXPORT-TargetTwice.cmake b/Tests/RunCMake/install/EXPORT-TargetTwice.cmake
new file mode 100644
index 0000000..cac4ff2
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-TargetTwice.cmake
@@ -0,0 +1,17 @@
+enable_language(C)
+
+add_library(foo STATIC empty.c)
+
+install(TARGETS foo
+ EXPORT pkg1
+ ARCHIVE DESTINATION pkg1/lib
+ INCLUDES DESTINATION pkg1/inc
+ )
+install(EXPORT pkg1 DESTINATION pkg1)
+
+install(TARGETS foo
+ EXPORT pkg2
+ ARCHIVE DESTINATION pkg2/lib
+ INCLUDES DESTINATION pkg2/inc
+ )
+install(EXPORT pkg2 DESTINATION pkg2)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index f79a3ea..7c12d4a 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -82,6 +82,7 @@ run_cmake(EXPORT-OldIFace)
run_cmake(EXPORT-UnknownExport)
run_cmake(EXPORT-NamelinkOnly)
run_cmake(EXPORT-SeparateNamelink)
+run_cmake(EXPORT-TargetTwice)
run_cmake(CMP0062-OLD)
run_cmake(CMP0062-NEW)
run_cmake(CMP0062-WARN)