diff options
author | Brad King <brad.king@kitware.com> | 2023-03-31 12:01:45 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-03-31 12:02:20 (GMT) |
commit | 215990673118fb44d2c4377de83c87deb45cdd75 (patch) | |
tree | 5b09f85a01c86707baa61d28e8b5836723f9b0e9 /Source/cmInstallTargetGenerator.cxx | |
parent | be3c564f8c5285ad75c18dd3ec4c16dd5c3e7154 (diff) | |
parent | 689616785f76acd844fd448c51c5b2a0711aafa2 (diff) | |
download | CMake-215990673118fb44d2c4377de83c87deb45cdd75.zip CMake-215990673118fb44d2c4377de83c87deb45cdd75.tar.gz CMake-215990673118fb44d2c4377de83c87deb45cdd75.tar.bz2 |
Merge topic 'strip-macos'
689616785f macOS: Do not pass Apple-specific flags to llvm-strip
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8374
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 9220123..3ac100d 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -828,26 +828,29 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent, return; } - if (!this->Target->Target->GetMakefile()->IsSet("CMAKE_STRIP")) { + std::string const& strip = + this->Target->Target->GetMakefile()->GetSafeDefinition("CMAKE_STRIP"); + if (strip.empty()) { return; } std::string stripArgs; - - // macOS 'strip' is picky, executables need '-u -r' and dylibs need '-x'. if (this->Target->IsApple()) { if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY || this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) { + // Strip tools need '-x' to strip Apple dylibs correctly. stripArgs = "-x "; - } else if (this->Target->GetType() == cmStateEnums::EXECUTABLE) { + } else if (this->Target->GetType() == cmStateEnums::EXECUTABLE && + this->Target->GetGlobalGenerator()->GetStripCommandStyle( + strip) == cmGlobalGenerator::StripCommandStyle::Apple) { + // Apple's strip tool needs '-u -r' to strip executables correctly. stripArgs = "-u -r "; } } os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n"; - os << indent << " execute_process(COMMAND \"" - << this->Target->Target->GetMakefile()->GetSafeDefinition("CMAKE_STRIP") - << "\" " << stripArgs << "\"" << toDestDirPath << "\")\n"; + os << indent << " execute_process(COMMAND \"" << strip << "\" " << stripArgs + << "\"" << toDestDirPath << "\")\n"; os << indent << "endif()\n"; } |