diff options
author | Brad King <brad.king@kitware.com> | 2019-01-31 16:18:34 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-01-31 16:18:40 (GMT) |
commit | 29368abde7d5b4d3d6f734aa530e82dd9f4ee739 (patch) | |
tree | 3afcedcaa9e0f67a612463b9ecb7f9a560cc551b /Source/cmInstallTargetGenerator.cxx | |
parent | 1b46f2f12a368e6e4049b814d0b8499394fa442e (diff) | |
parent | 20291e8e7293fd0ba0f5c66fe57388ee20381ccb (diff) | |
download | CMake-29368abde7d5b4d3d6f734aa530e82dd9f4ee739.zip CMake-29368abde7d5b4d3d6f734aa530e82dd9f4ee739.tar.gz CMake-29368abde7d5b4d3d6f734aa530e82dd9f4ee739.tar.bz2 |
Merge topic 'install-strip-macos'
20291e8e72 install: Fix stripping on macOS
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2892
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 26cebf0..59701a1 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -792,10 +792,22 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent, return; } + std::string stripArgs; + + // macOS 'strip' is picky, executables need '-u -r' and dylibs need '-x'. + if (this->Target->Target->GetMakefile()->IsOn("APPLE")) { + if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY || + this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) { + stripArgs = "-x "; + } else if (this->Target->GetType() == cmStateEnums::EXECUTABLE) { + stripArgs = "-u -r "; + } + } + os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n"; os << indent << " execute_process(COMMAND \"" << this->Target->Target->GetMakefile()->GetDefinition("CMAKE_STRIP") - << "\" \"" << toDestDirPath << "\")\n"; + << "\" " << stripArgs << "\"" << toDestDirPath << "\")\n"; os << indent << "endif()\n"; } |