Diagnostics: Capture install state

Modify `cmInstallGenerator` to have a `cmDiagnosticContext` instead of
just a `cmListFileBacktrace`. Create helpers to obtain a state capture
that includes `CMD_INSTALL_ABSOLUTE_DESTINATION`. Modify most subclasses
(namely, ones that have a `DESTINATION`) to use this new state capture.

This fixes a limitation identified when 39a56136a3 (Diagnostic: Add warn
or error on absolute install paths, 2026-03-25) added the aforementioned
diagnostic, that the install generator(s) no longer have access to the
diagnostic state as of the `install` invocation which ultimately caused
the diagnostic if that scope is not the top-most scope of the current
subdirectory.

Note that some of the generators which capture context have not actually
implemented the diagnostic yet.
This commit is contained in:
Matthew Woehlke
2026-05-08 11:23:11 -04:00
parent 42c7a97446
commit 5ed6b90a31
38 changed files with 157 additions and 141 deletions
+1 -1
View File
@@ -1649,7 +1649,7 @@ bool cmGlobalGenerator::Compute()
&exportSet.second, dest, "", std::vector<std::string>(), "",
cmInstallGenerator::SelectMessageLevel(this->Makefiles[0].get()),
false, std::move(sbomDefaultArgs), "",
this->Makefiles[0]->GetBacktrace()));
cmInstallGenerator::CaptureContext(this->Makefiles[0].get())));
}
}
#endif
+3 -3
View File
@@ -6,9 +6,9 @@
#include <cm/memory>
#include "cmDiagnosticContext.h"
#include "cmExportInstallAndroidMKGenerator.h"
#include "cmExportInstallFileGenerator.h"
#include "cmListFileCache.h"
class cmExportSet;
@@ -16,12 +16,12 @@ cmInstallAndroidMKExportGenerator::cmInstallAndroidMKExportGenerator(
cmExportSet* exportSet, std::string destination, std::string filePermissions,
std::vector<std::string> const& configurations, std::string component,
MessageLevel message, bool excludeFromAll, std::string filename,
std::string targetNamespace, cmListFileBacktrace backtrace)
std::string targetNamespace, cmDiagnosticContext context)
: cmInstallExportGenerator(exportSet, std::move(destination),
std::move(filePermissions), configurations,
std::move(component), message, excludeFromAll,
std::move(filename), std::move(targetNamespace),
std::string{}, std::move(backtrace))
std::string{}, std::move(context))
{
this->EFGen = cm::make_unique<cmExportInstallAndroidMKGenerator>(this);
}
+2 -2
View File
@@ -7,8 +7,8 @@
#include "cmInstallExportGenerator.h"
class cmDiagnosticContext;
class cmExportSet;
class cmListFileBacktrace;
/** \class cmInstallAndroidMKExportGenerator
* \brief Generate rules for creating Android .mk export files.
@@ -21,7 +21,7 @@ public:
std::string filePermissions,
std::vector<std::string> const& configurations, std::string component,
MessageLevel message, bool excludeFromAll, std::string filename,
std::string targetNamespace, cmListFileBacktrace backtrace);
std::string targetNamespace, cmDiagnosticContext context);
cmInstallAndroidMKExportGenerator(cmInstallAndroidMKExportGenerator const&) =
delete;
~cmInstallAndroidMKExportGenerator() override;
@@ -6,9 +6,9 @@
#include <cm/memory>
#include "cmDiagnosticContext.h"
#include "cmExportInstallCMakeConfigGenerator.h"
#include "cmExportInstallFileGenerator.h"
#include "cmListFileCache.h"
class cmExportSet;
@@ -17,12 +17,12 @@ cmInstallCMakeConfigExportGenerator::cmInstallCMakeConfigExportGenerator(
std::vector<std::string> const& configurations, std::string component,
MessageLevel message, bool excludeFromAll, std::string filename,
std::string targetNamespace, std::string cxxModulesDirectory, bool exportOld,
bool exportPackageDependencies, cmListFileBacktrace backtrace)
bool exportPackageDependencies, cmDiagnosticContext context)
: cmInstallExportGenerator(
exportSet, std::move(destination), std::move(filePermissions),
configurations, std::move(component), message, excludeFromAll,
std::move(filename), std::move(targetNamespace),
std::move(cxxModulesDirectory), std::move(backtrace))
std::move(cxxModulesDirectory), std::move(context))
, ExportOld(exportOld)
, ExportPackageDependencies(exportPackageDependencies)
{
+2 -2
View File
@@ -8,8 +8,8 @@
#include "cmInstallExportGenerator.h"
class cmDiagnosticContext;
class cmExportSet;
class cmListFileBacktrace;
/** \class cmInstallCMakeConfigExportGenerator
* \brief Generate rules for creating CMake export files.
@@ -24,7 +24,7 @@ public:
MessageLevel message, bool excludeFromAll, std::string filename,
std::string targetNamespace, std::string cxxModulesDirectory,
bool exportOld, bool exportPackageDependencies,
cmListFileBacktrace backtrace);
cmDiagnosticContext context);
cmInstallCMakeConfigExportGenerator(
cmInstallCMakeConfigExportGenerator const&) = delete;
~cmInstallCMakeConfigExportGenerator() override;
+38 -36
View File
@@ -20,6 +20,7 @@
#include "cmArgumentParser.h"
#include "cmArgumentParserTypes.h"
#include "cmCMakePath.h"
#include "cmDiagnosticContext.h"
#include "cmDiagnostics.h"
#include "cmExecutionStatus.h"
#include "cmExperimental.h"
@@ -59,8 +60,6 @@
#include "cmTargetExport.h"
#include "cmValue.h"
class cmListFileBacktrace;
namespace {
struct RuntimeDependenciesArgs
@@ -108,6 +107,11 @@ public:
}
}
cmDiagnosticContext CaptureContext() const
{
return cmInstallGenerator::CaptureContext(this->Makefile);
}
void SetError(std::string const& err) { this->Status.SetError(err); }
bool MakeFilesFullPath(char const* modeName,
@@ -137,7 +141,7 @@ public:
std::unique_ptr<cmInstallTargetGenerator> CreateInstallTargetGenerator(
cmTarget& target, cmInstallCommandArguments const& args, bool impLib,
cmListFileBacktrace const& backtrace, std::string const& destination,
cmDiagnosticContext context, std::string const& destination,
bool forceOpt = false, bool namelink = false)
{
cmInstallGenerator::MessageLevel message =
@@ -148,17 +152,16 @@ std::unique_ptr<cmInstallTargetGenerator> CreateInstallTargetGenerator(
auto g = cm::make_unique<cmInstallTargetGenerator>(
target.GetName(), destination, impLib, args.GetPermissions(),
args.GetConfigurations(), component, message, args.GetExcludeFromAll(),
args.GetOptional() || forceOpt, backtrace);
args.GetOptional() || forceOpt, std::move(context));
target.AddInstallGenerator(g.get());
return g;
}
std::unique_ptr<cmInstallTargetGenerator> CreateInstallTargetGenerator(
cmTarget& target, cmInstallCommandArguments const& args, bool impLib,
cmListFileBacktrace const& backtrace, bool forceOpt = false,
bool namelink = false)
cmDiagnosticContext context, bool forceOpt = false, bool namelink = false)
{
return CreateInstallTargetGenerator(target, args, impLib, backtrace,
return CreateInstallTargetGenerator(target, args, impLib, std::move(context),
args.GetDestination(), forceOpt,
namelink);
}
@@ -174,7 +177,7 @@ std::unique_ptr<cmInstallFilesGenerator> CreateInstallFilesGenerator(
absFiles, destination, programs, args.GetPermissions(),
args.GetConfigurations(), args.GetComponent(), message,
args.GetExcludeFromAll(), args.GetRename(), args.GetOptional(),
mf->GetBacktrace());
cmInstallGenerator::CaptureContext(mf));
}
std::unique_ptr<cmInstallFilesGenerator> CreateInstallFilesGenerator(
@@ -195,7 +198,7 @@ std::unique_ptr<cmInstallFileSetGenerator> CreateInstallFileSetGenerator(
target.GetName(), args.GetFileSet(), args.GetDestination(),
args.GetPermissions(), args.GetConfigurations(), args.GetComponent(),
message, args.GetExcludeFromAll(), args.GetOptional(),
helper.Makefile->GetBacktrace());
helper.CaptureContext());
}
void AddInstallRuntimeDependenciesGenerator(
@@ -253,8 +256,7 @@ void AddInstallRuntimeDependenciesGenerator(
runtimeDependenciesArgsRef.GetComponent(),
runtimeDependenciesArgsRef.GetPermissions(),
cmInstallGenerator::SelectMessageLevel(helper.Makefile),
runtimeDependenciesArgsRef.GetExcludeFromAll(),
helper.Makefile->GetBacktrace());
runtimeDependenciesArgsRef.GetExcludeFromAll(), helper.CaptureContext());
helper.Makefile->AddInstallGenerator(
std::move(libraryRuntimeDependenciesGenerator));
if (dllPlatform) {
@@ -273,7 +275,7 @@ void AddInstallRuntimeDependenciesGenerator(
frameworkArgs.GetDestination(), frameworkArgs.GetConfigurations(),
frameworkArgs.GetComponent(), frameworkArgs.GetPermissions(),
cmInstallGenerator::SelectMessageLevel(helper.Makefile),
frameworkArgs.GetExcludeFromAll(), helper.Makefile->GetBacktrace());
frameworkArgs.GetExcludeFromAll(), helper.CaptureContext());
helper.Makefile->AddInstallGenerator(
std::move(frameworkRuntimeDependenciesGenerator));
installsFramework = true;
@@ -830,21 +832,21 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (!archiveArgs.GetDestination().empty()) {
// The import library uses the ARCHIVE properties.
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, true, helper.Makefile->GetBacktrace());
target, archiveArgs, true, helper.CaptureContext());
artifactsSpecified = true;
}
if (!runtimeArgs.GetDestination().empty()) {
// The DLL uses the RUNTIME properties.
runtimeGenerator = CreateInstallTargetGenerator(
target, runtimeArgs, false, helper.Makefile->GetBacktrace());
target, runtimeArgs, false, helper.CaptureContext());
artifactsSpecified = true;
}
if (!archiveGenerator && !runtimeGenerator) {
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, true, helper.Makefile->GetBacktrace(),
target, archiveArgs, true, helper.CaptureContext(),
helper.GetArchiveDestination(nullptr));
runtimeGenerator = CreateInstallTargetGenerator(
target, runtimeArgs, false, helper.Makefile->GetBacktrace(),
target, runtimeArgs, false, helper.CaptureContext(),
helper.GetRuntimeDestination(nullptr));
}
if (runtimeDependencySet && runtimeGenerator) {
@@ -867,7 +869,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// Use the FRAMEWORK properties.
if (!frameworkArgs.GetDestination().empty()) {
frameworkGenerator = CreateInstallTargetGenerator(
target, frameworkArgs, false, helper.Makefile->GetBacktrace());
target, frameworkArgs, false, helper.CaptureContext());
} else {
status.SetError(
cmStrCat("TARGETS given no FRAMEWORK DESTINATION for shared "
@@ -882,14 +884,14 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
}
if (namelinkMode != cmInstallTargetGenerator::NamelinkModeOnly) {
libraryGenerator = CreateInstallTargetGenerator(
target, libraryArgs, false, helper.Makefile->GetBacktrace(),
target, libraryArgs, false, helper.CaptureContext(),
helper.GetLibraryDestination(&libraryArgs));
libraryGenerator->SetNamelinkMode(
cmInstallTargetGenerator::NamelinkModeSkip);
}
if (namelinkMode != cmInstallTargetGenerator::NamelinkModeSkip) {
namelinkGenerator = CreateInstallTargetGenerator(
target, libraryArgs, false, helper.Makefile->GetBacktrace(),
target, libraryArgs, false, helper.CaptureContext(),
helper.GetLibraryDestination(&libraryArgs), false, true);
namelinkGenerator->SetNamelinkMode(
cmInstallTargetGenerator::NamelinkModeOnly);
@@ -906,7 +908,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (importlinkMode !=
cmInstallTargetGenerator::NamelinkModeOnly) {
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, true, helper.Makefile->GetBacktrace(),
target, archiveArgs, true, helper.CaptureContext(),
helper.GetLibraryDestination(&archiveArgs));
archiveGenerator->SetImportlinkMode(
cmInstallTargetGenerator::NamelinkModeSkip);
@@ -914,7 +916,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (importlinkMode !=
cmInstallTargetGenerator::NamelinkModeSkip) {
importlinkGenerator = CreateInstallTargetGenerator(
target, archiveArgs, true, helper.Makefile->GetBacktrace(),
target, archiveArgs, true, helper.CaptureContext(),
helper.GetLibraryDestination(&archiveArgs), false, true);
importlinkGenerator->SetImportlinkMode(
cmInstallTargetGenerator::NamelinkModeOnly);
@@ -944,7 +946,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// Use the FRAMEWORK properties.
if (!frameworkArgs.GetDestination().empty()) {
frameworkGenerator = CreateInstallTargetGenerator(
target, frameworkArgs, false, helper.Makefile->GetBacktrace());
target, frameworkArgs, false, helper.CaptureContext());
} else {
status.SetError(
cmStrCat("TARGETS given no FRAMEWORK DESTINATION for static "
@@ -958,7 +960,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
artifactsSpecified = true;
}
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, false, helper.Makefile->GetBacktrace(),
target, archiveArgs, false, helper.CaptureContext(),
helper.GetArchiveDestination(&archiveArgs));
}
} break;
@@ -966,7 +968,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// Modules use LIBRARY properties.
if (!libraryArgs.GetDestination().empty()) {
libraryGenerator = CreateInstallTargetGenerator(
target, libraryArgs, false, helper.Makefile->GetBacktrace());
target, libraryArgs, false, helper.CaptureContext());
libraryGenerator->SetNamelinkMode(namelinkMode);
namelinkOnly =
(namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly);
@@ -994,7 +996,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
}
objectGenerator = CreateInstallTargetGenerator(
target, objectArgs, false, helper.Makefile->GetBacktrace());
target, objectArgs, false, helper.CaptureContext());
} else {
// Installing an OBJECT library without a destination transforms
// it to an INTERFACE library. It installs no files but can be
@@ -1006,7 +1008,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// Application bundles use the BUNDLE properties.
if (!bundleArgs.GetDestination().empty()) {
bundleGenerator = CreateInstallTargetGenerator(
target, bundleArgs, false, helper.Makefile->GetBacktrace());
target, bundleArgs, false, helper.CaptureContext());
}
if (!bundleGenerator) {
status.SetError(cmStrCat("TARGETS given no BUNDLE DESTINATION for "
@@ -1026,7 +1028,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
artifactsSpecified = true;
}
runtimeGenerator = CreateInstallTargetGenerator(
target, runtimeArgs, false, helper.Makefile->GetBacktrace(),
target, runtimeArgs, false, helper.CaptureContext(),
helper.GetRuntimeDestination(&runtimeArgs));
if (runtimeDependencySet) {
runtimeDependencySet->AddExecutable(runtimeGenerator.get());
@@ -1042,7 +1044,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// The import library uses the ARCHIVE properties.
artifactsSpecified = true;
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, true, helper.Makefile->GetBacktrace(), true);
target, archiveArgs, true, helper.CaptureContext(), true);
}
} break;
case cmStateEnums::INTERFACE_LIBRARY:
@@ -1150,7 +1152,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
cxxModuleBmiArgs.GetConfigurations(), cxxModuleBmiArgs.GetComponent(),
cmInstallGenerator::SelectMessageLevel(target.GetMakefile()),
cxxModuleBmiArgs.GetExcludeFromAll(), cxxModuleBmiArgs.GetOptional(),
helper.Makefile->GetBacktrace());
helper.CaptureContext());
target.SetHaveInstallRule(true);
}
@@ -1407,7 +1409,7 @@ bool HandleImportedRuntimeArtifactsMode(std::vector<std::string> const& args,
typeArgs.GetConfigurations(), typeArgs.GetComponent(),
cmInstallGenerator::SelectMessageLevel(helper.Makefile),
typeArgs.GetExcludeFromAll(), typeArgs.GetOptional(),
helper.Makefile->GetBacktrace());
helper.CaptureContext());
};
// Generate install script code to install the given targets.
@@ -1925,7 +1927,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
cm::make_unique<cmInstallDirectoryGenerator>(
dirs, *destination, permissionsFile, permissionsDir, configurations,
component, message, excludeFromAll, literalArgs, optional,
helper.Makefile->GetBacktrace()));
helper.CaptureContext()));
// Tell the global generator about any installation component names
// specified.
@@ -2022,7 +2024,7 @@ bool HandleExportAndroidMKMode(std::vector<std::string> const& args,
&exportSet, ica.GetDestination(), ica.GetPermissions(),
ica.GetConfigurations(), ica.GetComponent(), message,
ica.GetExcludeFromAll(), std::move(fname), std::move(exportNamespace),
helper.Makefile->GetBacktrace()));
helper.CaptureContext()));
return true;
#else
@@ -2172,7 +2174,7 @@ bool HandleMappedPackageInfo(
installCommandArgs.GetConfigurations(),
installCommandArgs.GetComponent(), message,
installCommandArgs.GetExcludeFromAll(), std::move(arguments),
cxxModulesDirectory, helper.Makefile->GetBacktrace()));
cxxModulesDirectory, helper.CaptureContext()));
return true;
}
@@ -2303,7 +2305,7 @@ bool HandleExportMode(std::vector<std::string> const& args,
ica.GetConfigurations(), ica.GetComponent(), message,
ica.GetExcludeFromAll(), std::move(fname), std::move(exportNamespace),
std::move(cxxModulesDirectory), exportOld, exportPackageDependencies,
helper.Makefile->GetBacktrace()));
helper.CaptureContext()));
return true;
}
@@ -2373,7 +2375,7 @@ bool HandlePackageInfoMode(std::vector<std::string> const& args,
&exportSet, dest, ica.GetPermissions(), ica.GetConfigurations(),
ica.GetComponent(), message, ica.GetExcludeFromAll(),
std::move(arguments), std::move(cxxModulesDirectory),
helper.Makefile->GetBacktrace()));
helper.CaptureContext()));
return true;
#else
@@ -2576,7 +2578,7 @@ bool HandleSbomMode(std::vector<std::string> const& args,
&exportSet, dest, ica.GetPermissions(), ica.GetConfigurations(),
ica.GetComponent(), message, ica.GetExcludeFromAll(),
std::move(arguments), std::move(cxxModulesDirectory),
helper.Makefile->GetBacktrace()));
helper.CaptureContext()));
return true;
#else
+3 -3
View File
@@ -5,10 +5,10 @@
#include <ostream>
#include <utility>
#include "cmDiagnosticContext.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmScriptGenerator.h"
#include "cmStringAlgorithms.h"
@@ -17,9 +17,9 @@ cmInstallCxxModuleBmiGenerator::cmInstallCxxModuleBmiGenerator(
std::string target, std::string const& dest, std::string filePermissions,
std::vector<std::string> const& configurations, std::string const& component,
MessageLevel message, bool excludeFromAll, bool optional,
cmListFileBacktrace backtrace)
cmDiagnosticContext context)
: cmInstallGenerator(dest, configurations, component, message,
excludeFromAll, false, std::move(backtrace))
excludeFromAll, false, std::move(context))
, TargetName(std::move(target))
, FilePermissions(std::move(filePermissions))
, Optional(optional)
+2 -2
View File
@@ -10,8 +10,8 @@
#include "cmInstallGenerator.h"
class cmDiagnosticContext;
class cmGeneratorTarget;
class cmListFileBacktrace;
class cmLocalGenerator;
/** \class cmInstallCxxModuleBmiGenerator
@@ -24,7 +24,7 @@ public:
std::string target, std::string const& dest, std::string filePermissions,
std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message, bool excludeFromAll,
bool optional, cmListFileBacktrace backtrace);
bool optional, cmDiagnosticContext context);
~cmInstallCxxModuleBmiGenerator() override;
bool Compute(cmLocalGenerator* lg) override;
+4 -5
View File
@@ -5,10 +5,10 @@
#include <algorithm>
#include <utility>
#include "cmDiagnosticContext.h"
#include "cmGeneratorExpression.h"
#include "cmInstallType.h"
#include "cmList.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
@@ -19,9 +19,9 @@ cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
std::string filePermissions, std::string dirPermissions,
std::vector<std::string> const& configurations, std::string const& component,
MessageLevel message, bool excludeFromAll, std::string literalArgs,
bool optional, cmListFileBacktrace backtrace)
bool optional, cmDiagnosticContext context)
: cmInstallGenerator(dest, configurations, component, message,
excludeFromAll, false, std::move(backtrace))
excludeFromAll, false, std::move(context))
, Directories(dirs)
, FilePermissions(std::move(filePermissions))
, DirPermissions(std::move(dirPermissions))
@@ -120,7 +120,6 @@ std::string cmInstallDirectoryGenerator::GetDestination(
{
std::string dest = cmGeneratorExpression::Evaluate(
this->Destination, this->LocalGenerator, config);
cmInstallGenerator::CheckAbsoluteDestination(dest, this->LocalGenerator,
this->Backtrace);
this->CheckAbsoluteDestination(dest, this->LocalGenerator);
return dest;
}
+2 -2
View File
@@ -10,7 +10,7 @@
#include "cmInstallGenerator.h"
class cmListFileBacktrace;
class cmDiagnosticContext;
class cmLocalGenerator;
/** \class cmInstallDirectoryGenerator
@@ -24,7 +24,7 @@ public:
std::string filePermissions, std::string dirPermissions,
std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message, bool excludeFromAll,
std::string literalArgs, bool optional, cmListFileBacktrace backtrace);
std::string literalArgs, bool optional, cmDiagnosticContext context);
~cmInstallDirectoryGenerator() override;
bool Compute(cmLocalGenerator* lg) override;
+3 -3
View File
@@ -7,10 +7,10 @@
#include <utility>
#include "cmCryptoHash.h"
#include "cmDiagnosticContext.h"
#include "cmExportInstallFileGenerator.h"
#include "cmExportSet.h"
#include "cmInstallType.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmScriptGenerator.h"
#include "cmStringAlgorithms.h"
@@ -21,10 +21,10 @@ cmInstallExportGenerator::cmInstallExportGenerator(
std::vector<std::string> const& configurations, std::string component,
MessageLevel message, bool excludeFromAll, std::string filename,
std::string targetNamespace, std::string cxxModulesDirectory,
cmListFileBacktrace backtrace)
cmDiagnosticContext context)
: cmInstallGenerator(std::move(destination), configurations,
std::move(component), message, excludeFromAll, false,
std::move(backtrace))
std::move(context))
, ExportSet(exportSet)
, FilePermissions(std::move(filePermissions))
, FileName(std::move(filename))
+2 -2
View File
@@ -11,9 +11,9 @@
#include "cmInstallGenerator.h"
class cmDiagnosticContext;
class cmExportInstallFileGenerator;
class cmExportSet;
class cmListFileBacktrace;
class cmLocalGenerator;
/** \class cmInstallExportGenerator
@@ -29,7 +29,7 @@ public:
bool excludeFromAll, std::string filename,
std::string targetNamespace,
std::string cxxModulesDirectory,
cmListFileBacktrace backtrace);
cmDiagnosticContext context);
cmInstallExportGenerator(cmInstallExportGenerator const&) = delete;
~cmInstallExportGenerator() override;
+5 -7
View File
@@ -11,6 +11,7 @@
#include <cm/string_view>
#include "cmDiagnosticContext.h"
#include "cmFileSetMetadata.h"
#include "cmGenExContext.h"
#include "cmGeneratorExpression.h"
@@ -20,7 +21,6 @@
#include "cmInstallDirs.h"
#include "cmInstallType.h"
#include "cmList.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -31,9 +31,9 @@ cmInstallFileSetGenerator::cmInstallFileSetGenerator(
std::string targetName, std::string fileSetName, std::string destination,
std::string filePermissions, std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message, bool excludeFromAll,
bool optional, cmListFileBacktrace backtrace)
bool optional, cmDiagnosticContext context)
: cmInstallGenerator(std::move(destination), configurations, component,
message, excludeFromAll, false, std::move(backtrace))
message, excludeFromAll, false, std::move(context))
, TargetName(std::move(targetName))
, FileSetName(std::move(fileSetName))
, FilePermissions(std::move(filePermissions))
@@ -95,8 +95,7 @@ bool cmInstallFileSetGenerator::Compute(cmLocalGenerator* lg)
std::string cmInstallFileSetGenerator::GetDestination() const
{
cmInstallGenerator::CheckAbsoluteDestination(
this->Destination, this->LocalGenerator, this->Backtrace);
this->CheckAbsoluteDestination(this->Destination, this->LocalGenerator);
return this->Destination;
}
@@ -115,8 +114,7 @@ cmInstallFileSetGenerator::GetDestination(cmGeneratorTarget* gte,
ge.Parse(this->Destination);
std::string const dest = cge->Evaluate(gte->LocalGenerator, config, gte);
cmInstallGenerator::CheckAbsoluteDestination(dest, gte->LocalGenerator,
this->Backtrace);
this->CheckAbsoluteDestination(dest, gte->LocalGenerator);
return { dest, cge->GetHadContextSensitiveCondition() };
}
+2 -2
View File
@@ -9,10 +9,10 @@
#include "cmInstallGenerator.h"
class cmDiagnosticContext;
class cmExportInstallCMakeConfigGenerator;
class cmGeneratorFileSet;
class cmGeneratorTarget;
class cmListFileBacktrace;
class cmLocalGenerator;
class cmInstallFileSetGenerator : public cmInstallGenerator
@@ -24,7 +24,7 @@ public:
std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message,
bool excludeFromAll, bool optional,
cmListFileBacktrace backtrace);
cmDiagnosticContext context);
~cmInstallFileSetGenerator() override;
bool Compute(cmLocalGenerator* lg) override;
+2 -1
View File
@@ -125,7 +125,8 @@ static void CreateInstallGenerator(cmMakefile& makefile,
cmInstallGenerator::SelectMessageLevel(&makefile);
makefile.AddInstallGenerator(cm::make_unique<cmInstallFilesGenerator>(
files, destination, false, no_permissions, no_configurations, no_component,
message, no_exclude_from_all, no_rename, false, makefile.GetBacktrace()));
message, no_exclude_from_all, no_rename, false,
cmInstallGenerator::CaptureContext(makefile)));
}
/**
+4 -5
View File
@@ -4,19 +4,19 @@
#include <utility>
#include "cmDiagnosticContext.h"
#include "cmGeneratorExpression.h"
#include "cmInstallType.h"
#include "cmList.h"
#include "cmListFileCache.h"
cmInstallFilesGenerator::cmInstallFilesGenerator(
std::vector<std::string> const& files, std::string const& dest,
bool programs, std::string filePermissions,
std::vector<std::string> const& configurations, std::string const& component,
MessageLevel message, bool excludeFromAll, std::string rename, bool optional,
cmListFileBacktrace backtrace)
cmDiagnosticContext context)
: cmInstallGenerator(dest, configurations, component, message,
excludeFromAll, false, std::move(backtrace))
excludeFromAll, false, std::move(context))
, Files(files)
, FilePermissions(std::move(filePermissions))
, Rename(std::move(rename))
@@ -56,8 +56,7 @@ std::string cmInstallFilesGenerator::GetDestination(
{
std::string dest = cmGeneratorExpression::Evaluate(
this->Destination, this->LocalGenerator, config);
cmInstallGenerator::CheckAbsoluteDestination(dest, this->LocalGenerator,
this->Backtrace);
this->CheckAbsoluteDestination(dest, this->LocalGenerator);
return dest;
}
+2 -2
View File
@@ -10,7 +10,7 @@
#include "cmInstallGenerator.h"
class cmListFileBacktrace;
class cmDiagnosticContext;
class cmLocalGenerator;
/** \class cmInstallFilesGenerator
@@ -25,7 +25,7 @@ public:
std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message,
bool excludeFromAll, std::string rename,
bool optional, cmListFileBacktrace backtrace);
bool optional, cmDiagnosticContext context);
~cmInstallFilesGenerator() override;
bool Compute(cmLocalGenerator* lg) override;
+13 -6
View File
@@ -8,7 +8,6 @@
#include <cm/string_view>
#include "cmDiagnostics.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
@@ -17,14 +16,14 @@
cmInstallGenerator::cmInstallGenerator(
std::string destination, std::vector<std::string> const& configurations,
std::string component, MessageLevel message, bool excludeFromAll,
bool allComponents, cmListFileBacktrace backtrace)
bool allComponents, cmDiagnosticContext context)
: cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations)
, Destination(std::move(destination))
, Component(std::move(component))
, Message(message)
, ExcludeFromAll(excludeFromAll)
, AllComponents(allComponents)
, Backtrace(std::move(backtrace))
, Context{ std::move(context) }
{
}
@@ -231,8 +230,8 @@ std::string cmInstallGenerator::ConvertToAbsoluteDestination(
return result;
}
void cmInstallGenerator::CheckAbsoluteDestination(
std::string const& dest, cmLocalGenerator* lg, cmListFileBacktrace const& bt)
void cmInstallGenerator::CheckAbsoluteDestination(std::string const& dest,
cmLocalGenerator* lg) const
{
if (!cmSystemTools::FileIsFullPath(dest)) {
return;
@@ -241,7 +240,7 @@ void cmInstallGenerator::CheckAbsoluteDestination(
cmDiagnostics::CMD_INSTALL_ABSOLUTE_DESTINATION,
cmStrCat("INSTALL command given absolute DESTINATION path (", dest,
").\n"),
bt);
this->Context);
}
cmInstallGenerator::MessageLevel cmInstallGenerator::SelectMessageLevel(
@@ -263,6 +262,14 @@ cmInstallGenerator::MessageLevel cmInstallGenerator::SelectMessageLevel(
return MessageDefault;
}
cmDiagnosticContext cmInstallGenerator::CaptureContext(cmMakefile const& mf)
{
cmDiagnosticContext context{ mf.GetBacktrace() };
context.RecordDiagnostic(cmDiagnostics::CMD_INSTALL_ABSOLUTE_DESTINATION,
mf.GetStateSnapshot());
return context;
}
std::string cmInstallGenerator::GetDestDirPath(std::string const& file)
{
// Construct the path of the file on disk after installation on
+17 -7
View File
@@ -9,12 +9,13 @@
#include <string>
#include <vector>
#include "cmDiagnosticContext.h"
#include "cmInstallType.h"
#include "cmListFileCache.h"
#include "cmScriptGenerator.h"
class cmLocalGenerator;
class cmMakefile;
class cmListFileBacktrace;
/** \class cmInstallGenerator
* \brief Support class for generating install scripts.
@@ -35,7 +36,7 @@ public:
std::vector<std::string> const& configurations,
std::string component, MessageLevel message,
bool excludeFromAll, bool allComponents,
cmListFileBacktrace backtrace);
cmDiagnosticContext context);
~cmInstallGenerator() override;
cmInstallGenerator(cmInstallGenerator const&) = delete;
@@ -56,9 +57,8 @@ public:
/** Get the install destination as it should appear in the
installation script. */
static std::string ConvertToAbsoluteDestination(std::string const& dest);
static void CheckAbsoluteDestination(std::string const& dest,
cmLocalGenerator* lg,
cmListFileBacktrace const& bt);
void CheckAbsoluteDestination(std::string const& dest,
cmLocalGenerator* lg) const;
/** Test if this generator installs something for a given configuration. */
bool InstallsForConfig(std::string const& config);
@@ -66,6 +66,13 @@ public:
/** Select message level from CMAKE_INSTALL_MESSAGE or 'never'. */
static MessageLevel SelectMessageLevel(cmMakefile* mf, bool never = false);
/** Capture context for generator. */
static cmDiagnosticContext CaptureContext(cmMakefile const& mf);
static cmDiagnosticContext CaptureContext(cmMakefile const* mf)
{
return cmInstallGenerator::CaptureContext(*mf);
}
virtual bool Compute(cmLocalGenerator*) { return true; }
std::string const& GetComponent() const { return this->Component; }
@@ -73,7 +80,10 @@ public:
bool GetExcludeFromAll() const { return this->ExcludeFromAll; }
bool GetAllComponentsFlag() const { return this->AllComponents; }
cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; }
cmListFileBacktrace const& GetBacktrace() const
{
return this->Context.GetBacktrace();
}
static std::string GetDestDirPath(std::string const& file);
@@ -101,5 +111,5 @@ protected:
MessageLevel const Message;
bool const ExcludeFromAll;
bool const AllComponents;
cmListFileBacktrace const Backtrace;
cmDiagnosticContext const Context;
};
@@ -13,6 +13,7 @@
#include <cm/string_view>
#include <cmext/string_view>
#include "cmDiagnosticContext.h"
#include "cmGeneratorExpression.h"
#include "cmInstallRuntimeDependencySet.h"
#include "cmListFileCache.h"
@@ -87,7 +88,7 @@ cmInstallGetRuntimeDependenciesGenerator::
MessageLevel message, bool excludeFromAll, cmListFileBacktrace backtrace,
cmPolicies::PolicyStatus policyStatusCMP0207)
: cmInstallGenerator("", configurations, "", message, excludeFromAll, false,
std::move(backtrace))
cmDiagnosticContext{ std::move(backtrace) })
, RuntimeDependencySet(runtimeDependencySet)
, Directories(std::move(directories))
, PreIncludeRegexes(std::move(preIncludeRegexes))
@@ -13,7 +13,6 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmInstallType.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -35,9 +34,9 @@ cmInstallImportedRuntimeArtifactsGenerator::
std::string filePermissions,
std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message, bool excludeFromAll,
bool optional, cmListFileBacktrace backtrace)
bool optional, cmDiagnosticContext context)
: cmInstallGenerator(dest, configurations, component, message,
excludeFromAll, false, std::move(backtrace))
excludeFromAll, false, std::move(context))
, TargetName(std::move(targetName))
, FilePermissions(std::move(filePermissions))
, Optional(optional)
@@ -6,8 +6,8 @@
#include <string>
#include <vector>
#include "cmDiagnosticContext.h"
#include "cmInstallGenerator.h"
#include "cmListFileCache.h"
class cmGeneratorTarget;
@@ -19,7 +19,7 @@ public:
std::string filePermissions,
std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message, bool excludeFromAll,
bool optional, cmListFileBacktrace backtrace = cmListFileBacktrace());
bool optional, cmDiagnosticContext context = {});
~cmInstallImportedRuntimeArtifactsGenerator() override = default;
bool Compute(cmLocalGenerator* lg) override;
@@ -6,9 +6,9 @@
#include <cm/memory>
#include "cmDiagnosticContext.h"
#include "cmExportInstallFileGenerator.h"
#include "cmExportInstallPackageInfoGenerator.h"
#include "cmListFileCache.h"
#include "cmPackageInfoArguments.h"
class cmExportSet;
@@ -17,12 +17,12 @@ cmInstallPackageInfoExportGenerator::cmInstallPackageInfoExportGenerator(
cmExportSet* exportSet, std::string destination, std::string filePermissions,
std::vector<std::string> const& configurations, std::string component,
MessageLevel message, bool excludeFromAll, cmPackageInfoArguments arguments,
std::string cxxModulesDirectory, cmListFileBacktrace backtrace)
std::string cxxModulesDirectory, cmDiagnosticContext context)
: cmInstallExportGenerator(
exportSet, std::move(destination), std::move(filePermissions),
configurations, std::move(component), message, excludeFromAll,
arguments.GetPackageFileName(), arguments.GetNamespace(),
std::move(cxxModulesDirectory), std::move(backtrace))
std::move(cxxModulesDirectory), std::move(context))
{
this->EFGen = cm::make_unique<cmExportInstallPackageInfoGenerator>(
this, std::move(arguments));
+2 -2
View File
@@ -7,8 +7,8 @@
#include "cmInstallExportGenerator.h"
class cmDiagnosticContext;
class cmExportSet;
class cmListFileBacktrace;
class cmPackageInfoArguments;
/** \class cmInstallPackageInfoGenerator
@@ -23,7 +23,7 @@ public:
std::vector<std::string> const& configurations, std::string component,
MessageLevel message, bool excludeFromAll,
cmPackageInfoArguments arguments, std::string cxxModulesDirectory,
cmListFileBacktrace backtrace);
cmDiagnosticContext context);
cmInstallPackageInfoExportGenerator(
cmInstallPackageInfoExportGenerator const&) = delete;
~cmInstallPackageInfoExportGenerator() override;
+2 -1
View File
@@ -99,7 +99,8 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
cmInstallGenerator::SelectMessageLevel(&makefile);
makefile.AddInstallGenerator(cm::make_unique<cmInstallFilesGenerator>(
files, destination, true, no_permissions, no_configurations, no_component,
message, no_exclude_from_all, no_rename, false, makefile.GetBacktrace()));
message, no_exclude_from_all, no_rename, false,
cmInstallGenerator::CaptureContext(makefile)));
}
/**
@@ -7,10 +7,10 @@
#include <utility>
#include <vector>
#include "cmDiagnosticContext.h"
#include "cmGeneratorExpression.h"
#include "cmInstallGenerator.h"
#include "cmInstallType.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -25,10 +25,10 @@ cmInstallRuntimeDependencySetGenerator::cmInstallRuntimeDependencySetGenerator(
char const* rpathPrefix, char const* tmpVarPrefix, std::string destination,
std::vector<std::string> const& configurations, std::string component,
std::string permissions, MessageLevel message, bool excludeFromAll,
cmListFileBacktrace backtrace)
cmDiagnosticContext context)
: cmInstallGenerator(std::move(destination), configurations,
std::move(component), message, excludeFromAll, false,
std::move(backtrace))
std::move(context))
, Type(type)
, DependencySet(dependencySet)
, InstallRPaths(std::move(installRPaths))
@@ -68,7 +68,7 @@ void cmInstallRuntimeDependencySetGenerator::GenerateScriptForConfig(
MessageType::FATAL_ERROR,
"INSTALL_NAME_DIR argument must not evaluate to an "
"empty string",
this->Backtrace);
this->Context.GetBacktrace());
return;
}
if (installNameDir.back() != '/') {
@@ -8,8 +8,8 @@
#include "cmInstallGenerator.h"
class cmDiagnosticContext;
class cmInstallRuntimeDependencySet;
class cmListFileBacktrace;
class cmLocalGenerator;
class cmInstallRuntimeDependencySetGenerator : public cmInstallGenerator
@@ -28,7 +28,7 @@ public:
char const* rpathPrefix, char const* tmpVarPrefix, std::string destination,
std::vector<std::string> const& configurations, std::string component,
std::string permissions, MessageLevel message, bool excludeFromAll,
cmListFileBacktrace backtrace);
cmDiagnosticContext context);
bool Compute(cmLocalGenerator* lg) override;
+3 -3
View File
@@ -6,9 +6,9 @@ file LICENSE.rst or https://cmake.org/licensing for details. */
#include <cm/memory>
#include "cmDiagnosticContext.h"
#include "cmExportInstallFileGenerator.h"
#include "cmExportInstallSbomGenerator.h"
#include "cmListFileCache.h"
#include "cmSbomArguments.h"
class cmExportSet;
@@ -17,12 +17,12 @@ cmInstallSbomExportGenerator::cmInstallSbomExportGenerator(
cmExportSet* exportSet, std::string destination, std::string filePermissions,
std::vector<std::string> const& configurations, std::string component,
MessageLevel message, bool excludeFromAll, cmSbomArguments args,
std::string cxxModulesDirectory, cmListFileBacktrace backtrace)
std::string cxxModulesDirectory, cmDiagnosticContext context)
: cmInstallExportGenerator(
exportSet, std::move(destination), std::move(filePermissions),
configurations, std::move(component), message, excludeFromAll,
args.GetPackageFileName(), args.GetNamespace(),
std::move(cxxModulesDirectory), std::move(backtrace))
std::move(cxxModulesDirectory), std::move(context))
{
this->EFGen = cm::make_unique<cmExportInstallSbomGenerator>(this, args);
}
+2 -2
View File
@@ -7,8 +7,8 @@
#include "cmInstallExportGenerator.h"
class cmDiagnosticContext;
class cmExportSet;
class cmListFileBacktrace;
class cmSbomArguments;
class cmInstallSbomExportGenerator final : public cmInstallExportGenerator
@@ -20,7 +20,7 @@ public:
std::string component, MessageLevel message,
bool excludeFromAll, cmSbomArguments arguments,
std::string cxxModulesDirectory,
cmListFileBacktrace backtrace);
cmDiagnosticContext context);
cmInstallSbomExportGenerator(cmInstallSbomExportGenerator const&) = delete;
~cmInstallSbomExportGenerator() override;
+2 -1
View File
@@ -6,6 +6,7 @@
#include <utility>
#include <vector>
#include "cmDiagnosticContext.h"
#include "cmDiagnostics.h"
#include "cmGeneratorExpression.h"
#include "cmLocalGenerator.h"
@@ -17,7 +18,7 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(
bool excludeFromAll, bool allComponents, cmListFileBacktrace backtrace)
: cmInstallGenerator("", std::vector<std::string>(), component,
MessageDefault, excludeFromAll, allComponents,
std::move(backtrace))
cmDiagnosticContext{ std::move(backtrace) })
, Script(std::move(script))
, Code(code)
{
+3 -1
View File
@@ -7,6 +7,7 @@
#include <utility>
#include <vector>
#include "cmDiagnosticContext.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -18,7 +19,8 @@ cmInstallSubdirectoryGenerator::cmInstallSubdirectoryGenerator(
cmMakefile* makefile, std::string binaryDirectory,
cmListFileBacktrace backtrace)
: cmInstallGenerator("", std::vector<std::string>(), "", MessageDefault,
false, false, std::move(backtrace))
false, false,
cmDiagnosticContext{ std::move(backtrace) })
, Makefile(makefile)
, BinaryDirectory(std::move(binaryDirectory))
{
+5 -3
View File
@@ -15,11 +15,13 @@
#include <cm/optional>
#include "cmComputeLinkInformation.h"
#include "cmDiagnosticContext.h"
#include "cmDiagnostics.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmInstallType.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -130,9 +132,9 @@ cmInstallTargetGenerator::cmInstallTargetGenerator(
std::string targetName, std::string const& dest, bool implib,
std::string filePermissions, std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message, bool excludeFromAll,
bool optional, cmListFileBacktrace backtrace)
bool optional, cmDiagnosticContext context)
: cmInstallGenerator(dest, configurations, component, message,
excludeFromAll, false, std::move(backtrace))
excludeFromAll, false, std::move(context))
, TargetName(std::move(targetName))
, FilePermissions(std::move(filePermissions))
, ImportLibrary(implib)
@@ -482,7 +484,7 @@ std::string cmInstallTargetGenerator::GetDestination(
cmLocalGenerator* lg = this->Target->GetLocalGenerator();
std::string dest =
cmGeneratorExpression::Evaluate(this->Destination, lg, config);
cmInstallGenerator::CheckAbsoluteDestination(dest, lg, this->Backtrace);
this->CheckAbsoluteDestination(dest, lg);
return dest;
}
+7 -7
View File
@@ -8,9 +8,9 @@
#include <string>
#include <vector>
#include "cmDiagnosticContext.h"
#include "cmInstallGenerator.h"
#include "cmInstallType.h"
#include "cmListFileCache.h"
class cmGeneratorTarget;
@@ -20,12 +20,12 @@ class cmGeneratorTarget;
class cmInstallTargetGenerator : public cmInstallGenerator
{
public:
cmInstallTargetGenerator(
std::string targetName, std::string const& dest, bool implib,
std::string filePermissions,
std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message, bool excludeFromAll,
bool optional, cmListFileBacktrace backtrace = cmListFileBacktrace());
cmInstallTargetGenerator(std::string targetName, std::string const& dest,
bool implib, std::string filePermissions,
std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message,
bool excludeFromAll, bool optional,
cmDiagnosticContext context = {});
~cmInstallTargetGenerator() override;
/** Select the policy for installing shared library linkable name
+3 -3
View File
@@ -87,9 +87,9 @@ run_cmake_with_options(FILES-AbsoluteDest-error -Werror=install-absolute-destina
run_cmake_with_options(FILES-AbsoluteDest-warn -Winstall-absolute-destination)
run_cmake_with_options(TARGETS-AbsoluteDest-error -Werror=install-absolute-destination)
run_cmake_with_options(TARGETS-AbsoluteDest-warn -Winstall-absolute-destination)
run_cmake_with_options(TARGETS-AbsoluteDest-archive-error -Werror=install-absolute-destination)
run_cmake_with_options(TARGETS-AbsoluteDest-library-error -Werror=install-absolute-destination)
run_cmake_with_options(TARGETS-AbsoluteDest-runtime-error -Werror=install-absolute-destination)
run_cmake(TARGETS-AbsoluteDest-archive-error)
run_cmake(TARGETS-AbsoluteDest-library-error)
run_cmake(TARGETS-AbsoluteDest-runtime-error)
run_cmake(EXPORT-Component)
run_cmake(EXPORT-FindDependencyExportGate)
run_cmake(EXPORT-OldIFace)
@@ -1,3 +1,4 @@
enable_language(C)
add_library(mylib STATIC empty.c)
cmake_diagnostic(SET CMD_INSTALL_ABSOLUTE_DESTINATION SEND_ERROR)
install(TARGETS mylib ARCHIVE DESTINATION /absolute/archive)
@@ -1,12 +1,3 @@
enable_language(C)
add_library(mylib STATIC empty.c)
# FIXME(#27770): This diagnostic is issued at generate time. Currently, the
# install generator doesn't capture the immediate diagnostic state, only the
# top-most state of the current subdirectory, which we cannot affect (because
# this test was include()d. When we fix that, we should test by changing the
# diagnostic action here rather than by -W... in the test CLI arguments.
# cmake_diagnostic(SET CMD_INSTALL_ABSOLUTE_DESTINATION SEND_ERROR)
cmake_diagnostic(PROMOTE CMD_INSTALL_ABSOLUTE_DESTINATION WARN)
install(TARGETS mylib DESTINATION /absolute/path)
@@ -1,3 +1,4 @@
enable_language(C)
add_library(mylib MODULE empty.c)
cmake_diagnostic(SET CMD_INSTALL_ABSOLUTE_DESTINATION SEND_ERROR)
install(TARGETS mylib LIBRARY DESTINATION /absolute/lib)
@@ -1,3 +1,4 @@
enable_language(C)
add_executable(myexe empty.c)
cmake_diagnostic(SET CMD_INSTALL_ABSOLUTE_DESTINATION SEND_ERROR)
install(TARGETS myexe RUNTIME DESTINATION /absolute/bin)