MantisBT - CMake
View Issue Details
0015346CMakeCMakepublic2015-01-13 05:412015-06-01 08:38
Daniele E. Domenichelli 
Ben Boeckel 
normalmajoralways
closedfixed 
CMake 3.1 
CMake 3.1.1CMake 3.1.1 
0015346: Xcode generator default target is no longer "ALL_BUILD"
Since CMake 3.1, the order of the targets is changed and therefore the default target for Xcode generator is no longer "ALL_BUILD" if there is at least one install command. Also some other custom targets were moved to the top of the list.
Using this small project:

  cmake_minimum_required(VERSION 2.8.9)
  project(FOO)
  install(CODE "message(FATAL_ERROR \"This fatal error should not happen\")")



- CMake 3.0.2

   * "xcodebuild -list" prints

       Targets:
          ALL_BUILD
          ZERO_CHECK
          install

   * "xcodebuild" executes the "ALL_BUILD" target

   * "cmake --build ." executes the "ALL_BUILD" target


- CMake 3.1

   * "xcodebuild -list" prints

       Targets:
          install
          ALL_BUILD
          ZERO_CHECK

   * "xcodebuild" executes the "install" target (and fails)

   * "cmake --build ." executes the "ALL_BUILD" target


Building the project with "cmake --build ." still works because it calls the correct target, but "xcodebuild" fails because the "install" target is called instead of the "ALL_BUILD" one.
No tags attached.
Issue History
2015-01-13 05:41Daniele E. DomenichelliNew Issue
2015-01-13 08:44Brad KingNote Added: 0037675
2015-01-13 08:44Brad KingTarget Version => CMake 3.1.1
2015-01-13 13:54Daniele E. DomenichelliNote Added: 0037677
2015-01-13 16:20Brad KingAssigned To => Ben Boeckel
2015-01-13 16:20Brad KingStatusnew => assigned
2015-01-13 16:21Brad KingNote Added: 0037680
2015-01-16 16:46Ben BoeckelNote Added: 0037721
2015-01-16 17:41Ben BoeckelNote Added: 0037725
2015-01-19 08:41Brad KingNote Added: 0037734
2015-01-19 09:23Brad KingNote Added: 0037735
2015-01-19 09:23Brad KingStatusassigned => resolved
2015-01-19 09:23Brad KingResolutionopen => fixed
2015-01-19 09:23Brad KingFixed in Version => CMake 3.1.1
2015-06-01 08:38Robert MaynardNote Added: 0038855
2015-06-01 08:38Robert MaynardStatusresolved => closed

Notes
(0037675)
Brad King   
2015-01-13 08:44   
Thanks, Daniele. Can you bisect this, please?
(0037677)
Daniele E. Domenichelli   
2015-01-13 13:54   
I don't have a mac, but I managed to borrow one... This appears to be the commit to blame:

  cmTarget: use a hash_map for cmTargets typedef
  http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9c9b66 [^]

Reverting it fixes the problem.
(0037680)
Brad King   
2015-01-13 16:21   
The VS generator uses a special ordering rule for its targets in cmGlobalVisualStudioGenerator::TargetCompare:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmGlobalVisualStudioGenerator.cxx;hb=v3.1.0#l827 [^]

Xcode needs to do the same thing instead of depending on the cmTargets map order.
(0037721)
Ben Boeckel   
2015-01-16 16:46   
Just for clarification, was it also wrong in 3.0 if a target was named "AAA"? Rudimentary testing here shows it is. So not completely my fault, just an exposed bug :) .
(0037725)
Ben Boeckel   
2015-01-16 17:41   
Merged into next based on v3.1.0 as 'xcode-target-sort'.
(0037734)
Brad King   
2015-01-19 08:41   
Re 0015346:0037725: The original commit exposed another bug, which I've now fixed:

 Xcode: Fix early termination on per-config source file error
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c0ff542c [^]

Then I rebased your original commit on the fix. The revised version is:

 Xcode: Sort targets deterministically and with ALL_BUILD first
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e0176e2 [^]
(0037735)
Brad King   
2015-01-19 09:23   
I've queued this for 3.1.1.
(0038855)
Robert Maynard   
2015-06-01 08:38   
Closing resolved issues that have not been updated in more than 4 months.