diff options
author | Brad King <brad.king@kitware.com> | 2019-01-30 14:42:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-30 15:28:40 (GMT) |
commit | 8a7f93d000f1676d6051027b0608ca7658c8f00e (patch) | |
tree | 501fddfe78d4df3720624a4dd8e320e1d3de6d14 /Source/cmGeneratorTarget.cxx | |
parent | eff9c69740d5d4a26025a89f517a612e446077c0 (diff) | |
download | CMake-8a7f93d000f1676d6051027b0608ca7658c8f00e.zip CMake-8a7f93d000f1676d6051027b0608ca7658c8f00e.tar.gz CMake-8a7f93d000f1676d6051027b0608ca7658c8f00e.tar.bz2 |
Xcode: Fix object library builds with sanitizers enabled
Using `xcodebuild -enableAddressSanitizer YES ...` causes object files
to be placed in a different directory name. Xcode provides a
placeholder for this that we can use in `OTHER_LDFLAGS` to reference
object files for linking the dependents of object libraries. However,
CMake's features for installing and exporting object libraries depend on
knowing the real path with no placeholders. For these cases, use the
default object directory. Users will then have to choose between
sanitizers and the installation and export features, but both will work
individually.
Fixes: #16289
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 86f10dc..78040c3 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3859,6 +3859,13 @@ std::string cmGeneratorTarget::GetObjectDirectory( // find and replace $(PROJECT_NAME) xcode placeholder const std::string projectName = this->LocalGenerator->GetProjectName(); cmSystemTools::ReplaceString(obj_dir, "$(PROJECT_NAME)", projectName); + // Replace Xcode's placeholder for the object file directory since + // installation and export scripts need to know the real directory. + // Xcode has build-time settings (e.g. for sanitizers) that affect this, + // but we use the default here. Users that want to enable sanitizers + // will do so at the cost of object library installation and export. + cmSystemTools::ReplaceString(obj_dir, "$(OBJECT_FILE_DIR_normal:base)", + "Objects-normal"); #endif return obj_dir; } |