MCPcopy Create free account
hub / github.com/Kitware/CMake / AddStripRule

Method AddStripRule

Source/cmInstallTargetGenerator.cxx:863–904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

861}
862
863void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent,
864 std::string const& toDestDirPath)
865{
866
867 // don't strip static and import libraries, because it removes the only
868 // symbol table they have so you can't link to them anymore
869 if (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
870 this->ImportLibrary || this->NamelinkMode == NamelinkModeOnly) {
871 return;
872 }
873
874 // Don't handle OSX Bundles.
875 if (this->Target->IsApple() &&
876 this->Target->GetPropertyAsBool("MACOSX_BUNDLE")) {
877 return;
878 }
879
880 std::string const& strip =
881 this->Target->Target->GetMakefile()->GetSafeDefinition("CMAKE_STRIP");
882 if (strip.empty()) {
883 return;
884 }
885
886 std::string stripArgs;
887 if (this->Target->IsApple()) {
888 if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
889 this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) {
890 // Strip tools need '-x' to strip Apple dylibs correctly.
891 stripArgs = "-x ";
892 } else if (this->Target->GetType() == cmStateEnums::EXECUTABLE &&
893 this->Target->GetGlobalGenerator()->GetStripCommandStyle(
894 strip) == cmGlobalGenerator::StripCommandStyle::Apple) {
895 // Apple's strip tool needs '-u -r' to strip executables correctly.
896 stripArgs = "-u -r ";
897 }
898 }
899
900 os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n";
901 os << indent << " execute_process(COMMAND \"" << strip << "\" " << stripArgs
902 << "\"" << toDestDirPath << "\")\n";
903 os << indent << "endif()\n";
904}
905
906void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, Indent indent,
907 std::string const& toDestDirPath)

Callers 1

PostReplacementTweaksMethod · 0.95

Calls 7

GetStripCommandStyleMethod · 0.80
GetTypeMethod · 0.45
IsAppleMethod · 0.45
GetPropertyAsBoolMethod · 0.45
GetMakefileMethod · 0.45
emptyMethod · 0.45
GetGlobalGeneratorMethod · 0.45

Tested by

no test coverage detected