summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmInstallCommand.cxx48
-rw-r--r--Source/cmInstallCommand.h1
-rw-r--r--Source/cmPolicies.cxx18
-rw-r--r--Source/cmPolicies.h1
4 files changed, 67 insertions, 1 deletions
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 80dcdfc..03bd159 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -536,7 +536,22 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
bundleGenerator = CreateInstallTargetGenerator(target, bundleArgs,
false);
}
- else
+ if(!runtimeArgs.GetDestination().empty())
+ {
+ bool failure = false;
+ if(this->CheckCMP0006(failure))
+ {
+ // For CMake 2.4 compatibility fallback to the RUNTIME
+ // properties.
+ bundleGenerator =
+ CreateInstallTargetGenerator(target, runtimeArgs, false);
+ }
+ else if(failure)
+ {
+ return false;
+ }
+ }
+ if(!bundleGenerator)
{
cmOStringStream e;
e << "TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE "
@@ -1284,3 +1299,34 @@ bool cmInstallCommand::MakeFilesFullPath(const char* modeName,
}
return true;
}
+
+//----------------------------------------------------------------------------
+bool cmInstallCommand::CheckCMP0006(bool& failure)
+{
+ switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0006))
+ {
+ case cmPolicies::WARN:
+ {
+ this->Makefile->IssueMessage(
+ cmake::AUTHOR_WARNING,
+ this->Makefile->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0006)
+ );
+ }
+ case cmPolicies::OLD:
+ // OLD behavior is to allow compatibility
+ return true;
+ case cmPolicies::NEW:
+ // NEW behavior is to disallow compatibility
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ failure = true;
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ this->Makefile->GetPolicies()
+ ->GetRequiredPolicyError(cmPolicies::CMP0006)
+ );
+ break;
+ }
+ return false;
+}
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index 4978059..0b7c95f 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -346,6 +346,7 @@ private:
bool MakeFilesFullPath(const char* modeName,
const std::vector<std::string>& relFiles,
std::vector<std::string>& absFiles);
+ bool CheckCMP0006(bool& failure);
};
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index b69a719..4e1b857 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -251,6 +251,24 @@ cmPolicies::cmPolicies()
"See documentation of the COMPILE_DEFINITIONS target property for "
"limitations of the escaping implementation.",
2,6,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0006, "CMP0006",
+ "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.",
+ "This policy determines whether the install(TARGETS) command must be "
+ "given a BUNDLE DESTINATION when asked to install a target with the "
+ "MACOSX_BUNDLE property set. "
+ "CMake 2.4 and below did not distinguish application bundles from "
+ "normal executables when installing targets. "
+ "CMake 2.6 provides a BUNDLE option to the install(TARGETS) command "
+ "that specifies rules specific to application bundles on the Mac. "
+ "Projects should use this option when installing a target with the "
+ "MACOSX_BUNDLE property set.\n"
+ "The OLD behavior for this policy is to fall back to the RUNTIME "
+ "DESTINATION if a BUNDLE DESTINATION is not given. "
+ "The NEW behavior for this policy is to produce an error if a bundle "
+ "target is installed without a BUNDLE DESTINATION.",
+ 2,6,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 5adfbfa..fed9d31 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -46,6 +46,7 @@ public:
CMP0003, // Linking does not include extra -L paths
CMP0004, // Libraries linked may not have leading or trailing whitespace
CMP0005, // Definition value escaping
+ CMP0006, // BUNDLE install rules needed for MACOSX_BUNDLE targets
// Always the last entry. Useful mostly to avoid adding a comma
// the last policy when adding a new one.