MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0016040 | CMake | CMake | public | 2016-03-30 16:57 | 2016-06-10 14:31 |
Reporter | Colin Cornaby | ||||
Assigned To | Gregor Jasny | ||||
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | moved | ||
Platform | Xcode 7.3 | OS | Mac OS | OS Version | 10.11 |
Product Version | CMake 3.5.1 | ||||
Target Version | Fixed in Version | ||||
Summary | 0016040: Generated Xcode Projects Have Wrong Paths to Object Library Dependencies | ||||
Description | We have a CMake project that has object libraries, and then a parent build target that wraps those object libraries into a static library. When I generate the Xcode output, the parent build target is referencing different paths than what the .o's were outputted to. I have a patch that fixes the issue, but I wanted to open a bug first, especially if I'm duplicating something (apologies, this is my first CMake bug.) The section of code that seems to be the issue in the Xcode generator is here: cmGlobalXCodeGenerator::GetObjectsNormalDirectory( const std::string &projName, const std::string &configName, const cmGeneratorTarget *t) const { std::string dir = t->GetLocalGenerator()->GetCurrentBinaryDirectory(); dir += "/"; dir += projName; dir += ".build/"; dir += configName; dir += "/"; dir += t->GetName(); dir += ".build/Objects-normal/"; return dir; } There are a few things wrong here: - The configuration name should be part of this path. Specifically the section of that path that is "foo.build/release" should be "foo.build/release-iphoneos". This behavior could be different for Mac targets, but I'm pretty sure it isn't. One reason I'm not straight submitting the patch yet. - The .o files get written to the temporary objects directory, not the binary output directory. I've wrapped this in a new function: std::string cmGlobalXCodeGenerator::GetTemporaryFilesDirectory( const std::string &projName, const std::string &configName, const cmGeneratorTarget *t) const { std::string dir = t->GetLocalGenerator()->GetCurrentBinaryDirectory(); dir += "/"; dir += projName; dir += ".build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/"; return dir; } I've then altered a few functions. GetObjectsNormalDirectory becomes: //---------------------------------------------------------------------------- std::string cmGlobalXCodeGenerator::GetObjectsNormalDirectory( const std::string &projName, const std::string &configName, const cmGeneratorTarget *t) const { std::string dir = GetTemporaryFilesDirectory(projName, configName, t); dir += t->GetName(); dir += ".build/Objects-normal/"; return dir; } The build setting creation gets altered a bit a well with: if(this->XcodeVersion >= 21) { std::string pncdir = this->GetObjectsNormalDirectory( this->CurrentProject, configName, gtgt); std::string tempdir = this->GetTemporaryFilesDirectory( this->CurrentProject, configName, gtgt); buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", this->CreateString(pncdir.c_str())); buildSettings->AddAttribute("CONFIGURATION_TEMP_DIR", this->CreateString(tempdir.c_str())); } else { buildSettings->AddAttribute("OBJROOT", this->CreateString(pndir.c_str())); pndir = this->GetObjectsNormalDirectory( this->CurrentProject, configName, gtgt); } } Again, mostly submitting this bug because I'm new to Cmake and I don't know if this is patching on top of behavior that is platform dependent. Please let me know if there is something I am missing here, or if I'm breaking something else with these patches! (I'm attaching a Git patch as well) | ||||
Steps To Reproduce | |||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | 0001-Fixes-for-.o-generation.patch (3,497) 2016-03-30 16:57 https://public.kitware.com/Bug/file/5663/0001-Fixes-for-.o-generation.patch test.zip (36,037) 2016-04-07 17:32 https://public.kitware.com/Bug/file/5670/test.zip 0001-Fixes-for-.o-generation-FIXED.patch (3,252) 2016-04-14 18:02 https://public.kitware.com/Bug/file/5677/0001-Fixes-for-.o-generation-FIXED.patch | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2016-03-30 16:57 | Colin Cornaby | New Issue | |||
2016-03-30 16:57 | Colin Cornaby | File Added: 0001-Fixes-for-.o-generation.patch | |||
2016-03-31 03:58 | Gregor Jasny | Assigned To | => Gregor Jasny | ||
2016-03-31 03:58 | Gregor Jasny | Status | new => assigned | ||
2016-03-31 04:00 | Gregor Jasny | Note Added: 0040773 | |||
2016-03-31 12:36 | Colin Cornaby | Note Added: 0040777 | |||
2016-04-07 17:32 | Colin Cornaby | File Added: test.zip | |||
2016-04-07 17:33 | Colin Cornaby | Note Added: 0040826 | |||
2016-04-07 17:34 | Colin Cornaby | Note Added: 0040827 | |||
2016-04-14 18:02 | Colin Cornaby | Note Added: 0040863 | |||
2016-04-14 18:02 | Colin Cornaby | File Added: 0001-Fixes-for-.o-generation-FIXED.patch | |||
2016-06-10 14:29 | Kitware Robot | Note Added: 0042971 | |||
2016-06-10 14:29 | Kitware Robot | Status | assigned => resolved | ||
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved | ||
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|