mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 07:11:52 +08:00
De-duplicate checks for whether a platform uses Windows DLLs
This commit is contained in:
@@ -259,9 +259,6 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
|||||||
t->GetSourceBacktraces(),
|
t->GetSourceBacktraces(),
|
||||||
this->SourceEntries, true);
|
this->SourceEntries, true);
|
||||||
|
|
||||||
this->DLLPlatform =
|
|
||||||
!this->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX").empty();
|
|
||||||
|
|
||||||
this->PolicyMap = t->GetPolicyMap();
|
this->PolicyMap = t->GetPolicyMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2357,7 +2354,7 @@ void cmGeneratorTarget::ComputeModuleDefinitionInfo(
|
|||||||
|
|
||||||
bool cmGeneratorTarget::IsDLLPlatform() const
|
bool cmGeneratorTarget::IsDLLPlatform() const
|
||||||
{
|
{
|
||||||
return this->DLLPlatform;
|
return this->Target->IsDLLPlatform();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
|
void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
|
||||||
|
@@ -913,7 +913,6 @@ private:
|
|||||||
mutable bool DebugSourcesDone;
|
mutable bool DebugSourcesDone;
|
||||||
mutable bool LinkImplementationLanguageIsContextDependent;
|
mutable bool LinkImplementationLanguageIsContextDependent;
|
||||||
mutable bool UtilityItemsDone;
|
mutable bool UtilityItemsDone;
|
||||||
bool DLLPlatform;
|
|
||||||
|
|
||||||
bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
|
bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
|
||||||
std::string& out) const;
|
std::string& out) const;
|
||||||
|
@@ -389,10 +389,6 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether this is a DLL platform.
|
|
||||||
bool dll_platform =
|
|
||||||
!this->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX").empty();
|
|
||||||
|
|
||||||
for (std::string const& tgt : targetList) {
|
for (std::string const& tgt : targetList) {
|
||||||
|
|
||||||
if (this->Makefile->IsAlias(tgt)) {
|
if (this->Makefile->IsAlias(tgt)) {
|
||||||
@@ -472,7 +468,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||||||
// Shared libraries are handled differently on DLL and non-DLL
|
// Shared libraries are handled differently on DLL and non-DLL
|
||||||
// platforms. All windows platforms are DLL platforms including
|
// platforms. All windows platforms are DLL platforms including
|
||||||
// cygwin. Currently no other platform is a DLL platform.
|
// cygwin. Currently no other platform is a DLL platform.
|
||||||
if (dll_platform) {
|
if (target.IsDLLPlatform()) {
|
||||||
// When in namelink only mode skip all libraries on Windows.
|
// When in namelink only mode skip all libraries on Windows.
|
||||||
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
|
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
|
||||||
continue;
|
continue;
|
||||||
@@ -641,7 +637,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||||||
// On DLL platforms an executable may also have an import
|
// On DLL platforms an executable may also have an import
|
||||||
// library. Install it to the archive destination if it
|
// library. Install it to the archive destination if it
|
||||||
// exists.
|
// exists.
|
||||||
if (dll_platform && !archiveArgs.GetDestination().empty() &&
|
if (target.IsDLLPlatform() && !archiveArgs.GetDestination().empty() &&
|
||||||
target.IsExecutableWithExports()) {
|
target.IsExecutableWithExports()) {
|
||||||
// The import library uses the ARCHIVE properties.
|
// The import library uses the ARCHIVE properties.
|
||||||
archiveGenerator = CreateInstallTargetGenerator(
|
archiveGenerator = CreateInstallTargetGenerator(
|
||||||
|
@@ -168,7 +168,7 @@ public:
|
|||||||
cmPropertyMap Properties;
|
cmPropertyMap Properties;
|
||||||
bool IsGeneratorProvided;
|
bool IsGeneratorProvided;
|
||||||
bool HaveInstallRule;
|
bool HaveInstallRule;
|
||||||
bool DLLPlatform;
|
bool IsDLLPlatform;
|
||||||
bool IsAndroid;
|
bool IsAndroid;
|
||||||
bool IsImportedTarget;
|
bool IsImportedTarget;
|
||||||
bool ImportedGloballyVisible;
|
bool ImportedGloballyVisible;
|
||||||
@@ -216,7 +216,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
|||||||
impl->Name = name;
|
impl->Name = name;
|
||||||
impl->IsGeneratorProvided = false;
|
impl->IsGeneratorProvided = false;
|
||||||
impl->HaveInstallRule = false;
|
impl->HaveInstallRule = false;
|
||||||
impl->DLLPlatform = false;
|
impl->IsDLLPlatform = false;
|
||||||
impl->IsAndroid = false;
|
impl->IsAndroid = false;
|
||||||
impl->IsImportedTarget =
|
impl->IsImportedTarget =
|
||||||
(vis == VisibilityImported || vis == VisibilityImportedGlobally);
|
(vis == VisibilityImported || vis == VisibilityImportedGlobally);
|
||||||
@@ -224,7 +224,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
|||||||
impl->BuildInterfaceIncludesAppended = false;
|
impl->BuildInterfaceIncludesAppended = false;
|
||||||
|
|
||||||
// Check whether this is a DLL platform.
|
// Check whether this is a DLL platform.
|
||||||
impl->DLLPlatform =
|
impl->IsDLLPlatform =
|
||||||
!impl->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX").empty();
|
!impl->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX").empty();
|
||||||
|
|
||||||
// Check whether we are targeting an Android platform.
|
// Check whether we are targeting an Android platform.
|
||||||
@@ -1657,6 +1657,11 @@ cmPropertyMap const& cmTarget::GetProperties() const
|
|||||||
return impl->Properties;
|
return impl->Properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmTarget::IsDLLPlatform() const
|
||||||
|
{
|
||||||
|
return impl->IsDLLPlatform;
|
||||||
|
}
|
||||||
|
|
||||||
bool cmTarget::IsImported() const
|
bool cmTarget::IsImported() const
|
||||||
{
|
{
|
||||||
return impl->IsImportedTarget;
|
return impl->IsImportedTarget;
|
||||||
@@ -1872,7 +1877,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
|
|||||||
// If we needed to find one of the mapped configurations but did not
|
// If we needed to find one of the mapped configurations but did not
|
||||||
// On a DLL platform there may be only IMPORTED_IMPLIB for a shared
|
// On a DLL platform there may be only IMPORTED_IMPLIB for a shared
|
||||||
// library or an executable with exports.
|
// library or an executable with exports.
|
||||||
bool allowImp = (impl->DLLPlatform &&
|
bool allowImp = (this->IsDLLPlatform() &&
|
||||||
(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
|
(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
|
||||||
this->IsExecutableWithExports()));
|
this->IsExecutableWithExports()));
|
||||||
|
|
||||||
|
@@ -177,6 +177,9 @@ public:
|
|||||||
//! Get all properties
|
//! Get all properties
|
||||||
cmPropertyMap const& GetProperties() const;
|
cmPropertyMap const& GetProperties() const;
|
||||||
|
|
||||||
|
//! Return whether or not the target is for a DLL platform.
|
||||||
|
bool IsDLLPlatform() const;
|
||||||
|
|
||||||
bool IsImported() const;
|
bool IsImported() const;
|
||||||
bool IsImportedGloballyVisible() const;
|
bool IsImportedGloballyVisible() const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user