View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013452CMakeCMakepublic2012-08-03 00:252013-01-09 10:54
ReporterGrant Limberg 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 2.8.8 
Target VersionCMake 2.8.10Fixed in Version 
Summary0013452: Invalid path generated to .o files in an object library with Xcode Generator
DescriptionWhen linking an executable to a library built using the new object library format for add_library(), the path to the .o files is invalid when linking the final executable.

I've attached a sample project:

CMakeLists.txt - project(CMAKE-BUG)
|
| - liba/CMakeLists.txt - project(A)
|
| - exec1/CMakeLists.txt - project(exec1)
|
| - exec2/CMakeLists.txt - project(exec2)

When Xcode goes to link the .o file from liba, the path given to the linker is:

/Users/grant/Development/CMakeBug/build/liba/exec2.build/Debug/A.build/Objects-normal/x86_64/a.o'

However, the actual path to the .o file is:

clang: error: no such file or directory: '/Users/grant/Development/CMakeBug/build/liba/CMAKE-BUG.build/Debug/A.build/Objects-normal/x86_64/a.o'

Somehow the folder that should be named CMAKE-BUG.build, after the top level project name, is being replaced with the name of the last executable project name that was loaded. In this case, exec2.build.


Steps To ReproduceSee attached minimal sample. Build on OS X with arguments "-G Xcode"
TagsNo tags attached.
Attached Fileszip file icon CMakeBug.zip [^] (2,586 bytes) 2012-08-03 00:25

 Relationships

  Notes
(0030163)
Brad King (manager)
2012-08-03 09:41

Try this patch:
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 938977b..c366bcb 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3739,7 +3739,7 @@ cmGlobalXCodeGenerator
 
   const char* configName = this->GetCMakeCFGIntDir();
   std::string dir = this->GetObjectsNormalDirectory(
-    this->CurrentProject, configName, gt->Target);
+    "$(PROJECT_NAME)", configName, gt->Target);
   if(this->XcodeVersion >= 21)
     {
     dir += "$(CURRENT_ARCH)/";
(0030164)
Brad King (manager)
2012-08-03 10:31

Fixed and test added:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b237dbd8 [^]

Thanks for the detailed report.
(0032009)
Robert Maynard (manager)
2013-01-09 10:54

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-08-03 00:25 Grant Limberg New Issue
2012-08-03 00:25 Grant Limberg File Added: CMakeBug.zip
2012-08-03 09:41 Brad King Note Added: 0030163
2012-08-03 09:41 Brad King Assigned To => Brad King
2012-08-03 09:41 Brad King Status new => assigned
2012-08-03 10:31 Brad King Note Added: 0030164
2012-08-03 10:31 Brad King Status assigned => resolved
2012-08-03 10:31 Brad King Resolution open => fixed
2012-08-03 10:31 Brad King Target Version => CMake 2.8.10
2013-01-09 10:54 Robert Maynard Note Added: 0032009
2013-01-09 10:54 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team