summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx6
-rw-r--r--Source/cmCMakePresetsGraph.cxx2
-rw-r--r--Source/cmCoreTryCompile.cxx85
-rw-r--r--Source/cmCoreTryCompile.h3
-rw-r--r--Source/cmGeneratorTarget.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx8
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmLinkLibrariesCommand.cxx2
-rw-r--r--Source/cmMakefile.cxx25
-rw-r--r--Source/cmMakefile.h1
-rw-r--r--Source/cmQtAutoMocUic.cxx11
-rw-r--r--Source/cmStateSnapshot.cxx19
-rw-r--r--Source/cmTarget.cxx82
-rw-r--r--Source/cmTarget.h2
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx3
16 files changed, 118 insertions, 137 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index d52bbbe..bd67b0d 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 24)
-set(CMake_VERSION_PATCH 20220908)
+set(CMake_VERSION_PATCH 20220914)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index d1fad62..daaf5fd 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -363,7 +363,11 @@ void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf)
cmValue dval = mf->GetDefinition("CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION");
if (dval) {
- this->SetTestOutputTruncation(dval);
+ if (!this->SetTestOutputTruncation(dval)) {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Invalid value for CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION: "
+ << dval << std::endl);
+ }
}
}
diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx
index c168a45..5b216bb 100644
--- a/Source/cmCMakePresetsGraph.cxx
+++ b/Source/cmCMakePresetsGraph.cxx
@@ -1115,7 +1115,7 @@ const char* cmCMakePresetsGraph::ResultToString(ReadFileResult result)
return "File version must be 2 or higher for build and test preset "
"support.";
case ReadFileResult::PACKAGE_PRESETS_UNSUPPORTED:
- return "File version must be 5 or higher for package preset support";
+ return "File version must be 6 or higher for package preset support";
case ReadFileResult::INCLUDE_UNSUPPORTED:
return "File version must be 4 or higher for include support";
case ReadFileResult::INVALID_INCLUDE:
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 0a6c359..654c9a3 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -13,6 +13,7 @@
#include <cmext/string_view>
#include "cmsys/Directory.hxx"
+#include "cmsys/FStream.hxx"
#include "cmArgumentParser.h"
#include "cmExportTryCompileFileGenerator.h"
@@ -694,6 +695,17 @@ bool cmCoreTryCompile::TryCompileCode(Arguments& arguments,
}
fprintf(fout, ")\n");
+ /* Write out the output location of the target we are building */
+ std::string perConfigGenex;
+ if (this->Makefile->GetGlobalGenerator()->IsMultiConfig()) {
+ perConfigGenex = "_$<UPPER_CASE:$<CONFIG>>";
+ }
+ fprintf(fout,
+ "file(GENERATE OUTPUT "
+ "\"${CMAKE_BINARY_DIR}/%s%s_loc\"\n",
+ targetName.c_str(), perConfigGenex.c_str());
+ fprintf(fout, " CONTENT $<TARGET_FILE:%s>)\n", targetName.c_str());
+
bool warnCMP0067 = false;
bool honorStandard = true;
@@ -935,7 +947,7 @@ bool cmCoreTryCompile::TryCompileCode(Arguments& arguments,
if (this->SrcFileSignature) {
std::string copyFileErrorMessage;
- this->FindOutputFile(targetName, targetType);
+ this->FindOutputFile(targetName);
if ((res == 0) && arguments.CopyFileTo) {
std::string const& copyFile = *arguments.CopyFileTo;
@@ -1035,62 +1047,37 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir)
}
}
-void cmCoreTryCompile::FindOutputFile(const std::string& targetName,
- cmStateEnums::TargetType targetType)
+void cmCoreTryCompile::FindOutputFile(const std::string& targetName)
{
this->FindErrorMessage.clear();
this->OutputFile.clear();
std::string tmpOutputFile = "/";
- if (targetType == cmStateEnums::EXECUTABLE) {
- tmpOutputFile += targetName;
- tmpOutputFile +=
- this->Makefile->GetSafeDefinition("CMAKE_EXECUTABLE_SUFFIX");
- } else // if (targetType == cmStateEnums::STATIC_LIBRARY)
- {
- tmpOutputFile +=
- this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_PREFIX");
- tmpOutputFile += targetName;
- tmpOutputFile +=
- this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX");
- }
+ tmpOutputFile += targetName;
- // a list of directories where to search for the compilation result
- // at first directly in the binary dir
- std::vector<std::string> searchDirs;
- searchDirs.emplace_back();
-
- cmValue config =
- this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
- // if a config was specified try that first
- if (cmNonempty(config)) {
- std::string tmp = cmStrCat('/', *config);
- searchDirs.emplace_back(std::move(tmp));
+ if (this->Makefile->GetGlobalGenerator()->IsMultiConfig()) {
+ tmpOutputFile += "_DEBUG";
}
- searchDirs.emplace_back("/Debug");
-
- // handle app-bundles (for targeting apple-platforms)
- std::string app = "/" + targetName + ".app";
- if (cmNonempty(config)) {
- std::string tmp = cmStrCat('/', *config, app);
- searchDirs.emplace_back(std::move(tmp));
+ tmpOutputFile += "_loc";
+
+ std::string command = cmStrCat(this->BinaryDirectory, tmpOutputFile);
+ if (!cmSystemTools::FileExists(command)) {
+ std::ostringstream emsg;
+ emsg << "Unable to find the recorded try_compile output location:\n";
+ emsg << cmStrCat(" ", command, "\n");
+ this->FindErrorMessage = emsg.str();
+ return;
}
- std::string tmp = "/Debug" + app;
- searchDirs.emplace_back(std::move(tmp));
- searchDirs.emplace_back(std::move(app));
-
- searchDirs.emplace_back("/Development");
- for (std::string const& sdir : searchDirs) {
- std::string command = cmStrCat(this->BinaryDirectory, sdir, tmpOutputFile);
- if (cmSystemTools::FileExists(command)) {
- this->OutputFile = cmSystemTools::CollapseFullPath(command);
- return;
- }
+ std::string outputFileLocation;
+ cmsys::ifstream ifs(command.c_str());
+ cmSystemTools::GetLineFromStream(ifs, outputFileLocation);
+ if (!cmSystemTools::FileExists(outputFileLocation)) {
+ std::ostringstream emsg;
+ emsg << "Recorded try_compile output location doesn't exist:\n";
+ emsg << cmStrCat(" ", outputFileLocation, "\n");
+ this->FindErrorMessage = emsg.str();
+ return;
}
- std::ostringstream emsg;
- emsg << "Unable to find the executable at any of:\n";
- emsg << cmWrap(" " + this->BinaryDirectory, searchDirs, tmpOutputFile, "\n")
- << "\n";
- this->FindErrorMessage = emsg.str();
+ this->OutputFile = cmSystemTools::CollapseFullPath(outputFileLocation);
}
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index b483f0f..729aa9f 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -94,8 +94,7 @@ public:
TryCompileCode. The result is stored in OutputFile. If nothing is found,
the error message is stored in FindErrorMessage.
*/
- void FindOutputFile(const std::string& targetName,
- cmStateEnums::TargetType targetType);
+ void FindOutputFile(const std::string& targetName);
std::string BinaryDirectory;
std::string OutputFile;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 54c900f..7f1e426 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -8666,7 +8666,7 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
verifyTarget->SetProperty("UNITY_BUILD", "OFF");
cm::optional<std::map<std::string, cmValue>>
perConfigCompileDefinitions;
- verifyTarget->FinalizeTargetCompileInfo(
+ verifyTarget->FinalizeTargetConfiguration(
this->Makefile->GetCompileDefinitionsEntries(),
perConfigCompileDefinitions);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 07ad1e8..09aaa24 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1501,7 +1501,7 @@ bool cmGlobalGenerator::Compute()
if (!this->CheckALLOW_DUPLICATE_CUSTOM_TARGETS()) {
return false;
}
- this->FinalizeTargetCompileInfo();
+ this->FinalizeTargetConfiguration();
this->CreateGenerationObjects();
@@ -1825,7 +1825,7 @@ cmGlobalGenerator::CreateMSVC60LinkLineComputer(
cm::make_unique<cmMSVC60LinkLineComputer>(outputConverter, stateDir));
}
-void cmGlobalGenerator::FinalizeTargetCompileInfo()
+void cmGlobalGenerator::FinalizeTargetConfiguration()
{
std::vector<std::string> const langs =
this->CMakeInstance->GetState()->GetEnabledLanguages();
@@ -1838,8 +1838,8 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
for (auto& target : mf->GetTargets()) {
cmTarget* t = &target.second;
- t->FinalizeTargetCompileInfo(noConfigCompileDefinitions,
- perConfigCompileDefinitions);
+ t->FinalizeTargetConfiguration(noConfigCompileDefinitions,
+ perConfigCompileDefinitions);
}
// The standard include directories for each language
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index dcef070..6e3072b 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -694,7 +694,7 @@ private:
void WriteSummary();
void WriteSummary(cmGeneratorTarget* target);
- void FinalizeTargetCompileInfo();
+ void FinalizeTargetConfiguration();
virtual void ForceLinkerLanguages();
diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx
index ed89e91..2b8f836 100644
--- a/Source/cmLinkLibrariesCommand.cxx
+++ b/Source/cmLinkLibrariesCommand.cxx
@@ -35,7 +35,5 @@ bool cmLinkLibrariesCommand(std::vector<std::string> const& args,
mf.AppendProperty("LINK_LIBRARIES", *i);
}
- mf.CheckProperty("LINK_LIBRARIES");
-
return true;
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 760ed5f..cf5d880 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4035,31 +4035,6 @@ std::vector<std::string> cmMakefile::GetPropertyKeys() const
return this->StateSnapshot.GetDirectory().GetPropertyKeys();
}
-void cmMakefile::CheckProperty(const std::string& prop) const
-{
- // Certain properties need checking.
- if (prop == "LINK_LIBRARIES") {
- if (cmValue value = this->GetProperty(prop)) {
- // Look for <LINK_LIBRARY:> internal pattern
- static cmsys::RegularExpression linkPattern(
- "(^|;)(</?LINK_(LIBRARY|GROUP):[^;>]*>)(;|$)");
- if (!linkPattern.find(value)) {
- return;
- }
-
- // Report an error.
- this->IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat("Property ", prop, " contains the invalid item \"",
- linkPattern.match(2), "\". The ", prop,
- " property may contain the generator-expression \"$<LINK_",
- linkPattern.match(3),
- ":...>\" which may be used to specify how the libraries are "
- "linked."));
- }
- }
-}
-
cmTarget* cmMakefile::FindLocalNonAliasTarget(const std::string& name) const
{
auto i = this->Targets.find(name);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 1763177..873454d 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -808,7 +808,6 @@ public:
cmValue GetProperty(const std::string& prop, bool chain) const;
bool GetPropertyAsBool(const std::string& prop) const;
std::vector<std::string> GetPropertyKeys() const;
- void CheckProperty(const std::string& prop) const;
//! Initialize a makefile from its parent
void InitializeFromParent(cmMakefile* parent);
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 8adaa6c..4753e61 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -2175,18 +2175,9 @@ void cmQtAutoMocUicT::JobMocsCompilationT::Process()
if (this->MocEval().CompFiles.empty()) {
// Placeholder content
- cmCryptoHash hash(cmCryptoHash::AlgoSHA256);
- const std::string hashedPath = hash.HashString(compAbs);
- const std::string functionName =
- "cmake_automoc_silence_linker_warning" + hashedPath;
-
content += "// No files found that require moc or the moc files are "
"included\n"
- "void " +
- functionName +
- "();\n"
- "void " +
- functionName + "() {}\n";
+ "enum some_compilers { need_more_than_nothing };\n";
} else {
// Valid content
const bool mc = this->BaseConst().MultiConfig;
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index f73df8f..c51650a 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -317,6 +317,25 @@ void cmStateSnapshot::SetDefaultDefinitions()
this->SetDefinition("CMAKE_HOST_SOLARIS", "1");
#endif
+#if defined(__OpenBSD__)
+ this->SetDefinition("BSD", "OpenBSD");
+ this->SetDefinition("CMAKE_HOST_BSD", "OpenBSD");
+#elif defined(__FreeBSD__)
+ this->SetDefinition("BSD", "FreeBSD");
+ this->SetDefinition("CMAKE_HOST_BSD", "FreeBSD");
+#elif defined(__NetBSD__)
+ this->SetDefinition("BSD", "NetBSD");
+ this->SetDefinition("CMAKE_HOST_BSD", "NetBSD");
+#elif defined(__DragonFly__)
+ this->SetDefinition("BSD", "DragonFlyBSD");
+ this->SetDefinition("CMAKE_HOST_BSD", "DragonFlyBSD");
+#endif
+
+#if defined(__linux__)
+ this->SetDefinition("LINUX", "1");
+ this->SetDefinition("CMAKE_HOST_LINUX", "1");
+#endif
+
this->SetDefinition("CMAKE_MAJOR_VERSION",
std::to_string(cmVersion::GetMajorVersion()));
this->SetDefinition("CMAKE_MINOR_VERSION",
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index eb3feaa..25ff3bf 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1947,7 +1947,41 @@ void cmTarget::AppendBuildInterfaceIncludes()
}
}
-void cmTarget::FinalizeTargetCompileInfo(
+namespace {
+bool CheckLinkLibraryPattern(cm::string_view property,
+ const std::vector<BT<std::string>>& value,
+ cmake* context)
+{
+ // Look for <LINK_LIBRARY:> and </LINK_LIBRARY:> internal tags
+ static cmsys::RegularExpression linkPattern(
+ "(^|;)(</?LINK_(LIBRARY|GROUP):[^;>]*>)(;|$)");
+
+ bool isValid = true;
+
+ for (const auto& item : value) {
+ if (!linkPattern.find(item.Value)) {
+ continue;
+ }
+
+ isValid = false;
+
+ // Report an error.
+ context->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(
+ "Property ", property, " contains the invalid item \"",
+ linkPattern.match(2), "\". The ", property,
+ " property may contain the generator-expression \"$<LINK_",
+ linkPattern.match(3),
+ ":...>\" which may be used to specify how the libraries are linked."),
+ item.Backtrace);
+ }
+
+ return isValid;
+}
+}
+
+void cmTarget::FinalizeTargetConfiguration(
const cmBTStringRange& noConfigCompileDefinitions,
cm::optional<std::map<std::string, cmValue>>& perConfigCompileDefinitions)
{
@@ -1955,6 +1989,18 @@ void cmTarget::FinalizeTargetCompileInfo(
return;
}
+ if (!CheckLinkLibraryPattern("LINK_LIBRARIES"_s,
+ this->impl->LinkImplementationPropertyEntries,
+ this->GetMakefile()->GetCMakeInstance()) ||
+ !CheckLinkLibraryPattern("INTERFACE_LINK_LIBRARIES"_s,
+ this->impl->LinkInterfacePropertyEntries,
+ this->GetMakefile()->GetCMakeInstance()) ||
+ !CheckLinkLibraryPattern("INTERFACE_LINK_LIBRARIES_DIRECT"_s,
+ this->impl->LinkInterfaceDirectPropertyEntries,
+ this->GetMakefile()->GetCMakeInstance())) {
+ return;
+ }
+
this->AppendBuildInterfaceIncludes();
if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
@@ -2035,27 +2081,6 @@ void cmTarget::InsertPrecompileHeader(BT<std::string> const& entry)
}
namespace {
-void CheckLinkLibraryPattern(const std::string& property,
- const std::string& value, cmMakefile* context)
-{
- // Look for <LINK_LIBRARY:> and </LINK_LIBRARY:> internal tags
- static cmsys::RegularExpression linkPattern(
- "(^|;)(</?LINK_(LIBRARY|GROUP):[^;>]*>)(;|$)");
- if (!linkPattern.find(value)) {
- return;
- }
-
- // Report an error.
- context->IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat(
- "Property ", property, " contains the invalid item \"",
- linkPattern.match(2), "\". The ", property,
- " property may contain the generator-expression \"$<LINK_",
- linkPattern.match(3),
- ":...>\" which may be used to specify how the libraries are linked."));
-}
-
void CheckLINK_INTERFACE_LIBRARIES(const std::string& prop,
const std::string& value,
cmMakefile* context, bool imported)
@@ -2090,13 +2115,6 @@ void CheckLINK_INTERFACE_LIBRARIES(const std::string& prop,
}
context->IssueMessage(MessageType::FATAL_ERROR, e.str());
}
-
- CheckLinkLibraryPattern(base, value, context);
-}
-
-void CheckLINK_LIBRARIES(const std::string& value, cmMakefile* context)
-{
- CheckLinkLibraryPattern("LINK_LIBRARIES", value, context);
}
void CheckINTERFACE_LINK_LIBRARIES(const std::string& value,
@@ -2117,8 +2135,6 @@ void CheckINTERFACE_LINK_LIBRARIES(const std::string& value,
context->IssueMessage(MessageType::FATAL_ERROR, e.str());
}
-
- CheckLinkLibraryPattern("INTERFACE_LINK_LIBRARIES", value, context);
}
void CheckIMPORTED_GLOBAL(const cmTarget* target, cmMakefile* context)
@@ -2151,10 +2167,6 @@ void cmTarget::CheckProperty(const std::string& prop,
if (cmValue value = this->GetProperty(prop)) {
CheckLINK_INTERFACE_LIBRARIES(prop, *value, context, true);
}
- } else if (prop == "LINK_LIBRARIES") {
- if (cmValue value = this->GetProperty(prop)) {
- CheckLINK_LIBRARIES(*value, context);
- }
} else if (prop == "INTERFACE_LINK_LIBRARIES") {
if (cmValue value = this->GetProperty(prop)) {
CheckINTERFACE_LINK_LIBRARIES(*value, context);
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 1550f5b..38bd036 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -238,7 +238,7 @@ public:
void InsertPrecompileHeader(BT<std::string> const& entry);
void AppendBuildInterfaceIncludes();
- void FinalizeTargetCompileInfo(
+ void FinalizeTargetConfiguration(
const cmBTStringRange& noConfigCompileDefinitions,
cm::optional<std::map<std::string, cmValue>>& perConfigCompileDefinitions);
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index fb03b62..0b123b2 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -379,9 +379,6 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
}
- target->CheckProperty("LINK_LIBRARIES", &mf);
- target->CheckProperty("INTERFACE_LINK_LIBRARIES", &mf);
-
return true;
}