MantisBT - CMake
View Issue Details
0013603CMakeCMakepublic2012-10-24 07:122013-03-04 08:38
David Weese 
Brad King 
highmajoralways
closedfixed 
AppleMac OS X10.8
CMake 2.8.9 
CMake 2.8.11CMake 2.8.11 
0013603: Absolute path missing in ReRunCMake.make created by the Xcode generator
Hi all,

we observed a bug in the CMakeScripts created by the Xcode generator. It is related to subprojects that depend on another. The problem is a missing absolute path to CMakeFiles/cmake.check_cache in a makefile. As a result it is not possible to build a target from a subproject as the ZERO_CHECK target cannot find cmake.check_cache and always assumes that it needs to rerun cmake.

This bug only occurs in the makefiles created by the Xcode generator. The Unix Makefiles generator works fine.

I fixed the bug in the sources of cmake where the wrong Makefile is created and recompiled a binary which works for us. See the diff in the Additional Information below.

Cheers,
David


Bug details:

When cmake is called to create an Xcode project, it will create a CMakeFiles/cmake.check_cache in the root build-folder. It also creates for each subproject a CMakeScripts/ReRunCMake.make Makefile, e.g. core/CMakeScripts/ReRunCMake.make, which looks like:

# Generated by CMake, DO NOT EDIT
CMakeFiles/cmake.check_cache: \
/Users/weese/seqan2/core/demos/CMakeLists.txt\
/Users/weese/seqan2/core/demos/howto/CMakeLists.txt\
/Users/weese/seqan2/core/demos/howto/scores/CMakeLists.txt\
/Users/weese/seqan2/core/demos/tutorial/CMakeLists.txt\
...

The problem is that this makfile is not executed in the root build-folder, but in the subproject folder where there is no CMakeFiles/cmake.check_cache file. Appending an absolute path in front of "CMakeFiles/cmake.check_cache" fixes the problem, this is also done by the Unix Makefile generator.
Just execute the following lines to check out SeqAn, generate an Xcode project, open the core/demos subproject:

svn co http://svn.seqan.de/seqan/trunk [^] seqan-trunk
mkdir seqan-trunk/xcode
cd seqan-trunk/xcode
cmake .. -G Xcode
open core/demos/seqan_core_demos.xcodeproj

Now select the "alignment" target and try to build. It will always rerun cmake and then interrupt. When opening the main project seqan.xcodeproj everything works fine.
I could fix the problem by adding the following line into Source/cmGlobalXCodeGenerator.cxx which prepends an absolute path to the root folder containing the CMakeFiles/cmake.check_cache target.

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index e8ab38f..960eb2c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -495,6 +495,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
     (this->CurrentReRunCMakeMakefile.c_str());
   makefileStream.SetCopyIfDifferent(true);
   makefileStream << "# Generated by CMake, DO NOT EDIT\n";
+ makefileStream << mf->GetHomeOutputDirectory() << '/';
   makefileStream << cmake::GetCMakeFilesDirectoryPostSlash();
   makefileStream << "cmake.check_cache: ";
   for(std::vector<std::string>::const_iterator i = lfiles.begin();
No tags attached.
patch 0001-Xcode-Fix-ReRunCMake.make-path-to-cmake.check_cache-.patch (1,564) 2012-10-24 14:14
https://public.kitware.com/Bug/file/4531/0001-Xcode-Fix-ReRunCMake.make-path-to-cmake.check_cache-.patch
Issue History
2012-10-24 07:12David WeeseNew Issue
2012-10-24 13:35Brad KingAssigned To => Brad King
2012-10-24 13:35Brad KingStatusnew => assigned
2012-10-24 13:35Brad KingTarget Version => CMake 2.8.11
2012-10-24 14:14Brad KingFile Added: 0001-Xcode-Fix-ReRunCMake.make-path-to-cmake.check_cache-.patch
2012-10-24 14:15Brad KingNote Added: 0031306
2012-10-25 14:39David WeeseNote Added: 0031330
2012-10-25 15:17Brad KingNote Added: 0031331
2012-10-25 15:17Brad KingStatusassigned => resolved
2012-10-25 15:17Brad KingResolutionopen => fixed
2012-10-25 15:17Brad KingFixed in Version => CMake 2.8.11
2013-03-04 08:38Robert MaynardNote Added: 0032491
2013-03-04 08:38Robert MaynardStatusresolved => closed

Notes
(0031306)
Brad King   
2012-10-24 14:15   
Please try "0001-Xcode-Fix-ReRunCMake.make-path-to-cmake.check_cache-.patch".
(0031330)
David Weese   
2012-10-25 14:39   
Yes, your patch works as well.
(0031331)
Brad King   
2012-10-25 15:17   
Thanks for testing. Applied:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=388a3216 [^]
(0032491)
Robert Maynard   
2013-03-04 08:38   
Closing resolved issues that have not been updated in more than 4 months.