Ninja: Fix POST_BUILD commands on macOS Frameworks

The condition added by commit v2.8.12~179^2 (OS X: Fix regression
handling frameworks for Ninja, 2013-07-16) for excluding use of
versioning symlinks on macOS Frameworks must match that used for
POST_BUILD selection.  Otherwise we place the POST_BUILD commands after
a symlink step that is never added.

Closes: #16363
This commit is contained in:
Brad King 2016-10-13 13:51:10 -04:00
parent b99bbfe88d
commit 20278872e3
2 changed files with 9 additions and 2 deletions

View File

@ -645,7 +645,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
std::string postBuildCmdLine = localGen.BuildCommandLine(postBuildCmdLines);
cmNinjaVars symlinkVars;
if (targetOutput == targetOutputReal) {
bool const symlinkNeeded =
(targetOutput != targetOutputReal && !gt.IsFrameworkOnApple());
if (!symlinkNeeded) {
vars["POST_BUILD"] = postBuildCmdLine;
} else {
vars["POST_BUILD"] = ":";
@ -687,7 +689,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
commandLineLengthLimit, &usedResponseFile);
this->WriteLinkRule(usedResponseFile);
if (targetOutput != targetOutputReal && !gt.IsFrameworkOnApple()) {
if (symlinkNeeded) {
if (targetType == cmState::EXECUTABLE) {
globalGen.WriteBuild(
this->GetBuildFileStream(),

View File

@ -51,6 +51,11 @@ install(TARGETS foo bar
# duplicate install rules for the pieces of the framework.
)
# test that framework post-build commands run
add_custom_command(TARGET foo POST_BUILD COMMAND ${CMAKE_COMMAND} -E touch foo-post-build)
add_custom_target(fooCustom ALL COMMAND ${CMAKE_COMMAND} -E copy foo-post-build foo-custom)
add_dependencies(fooCustom foo)
# Make a static library and apply the framework properties to it to verify
# that everything still builds correctly, but it will not actually produce
# a framework... The framework properties only apply when the library type