View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014291 | CMake | CMake | public | 2013-07-15 10:43 | 2013-12-02 08:51 | ||||
Reporter | Paul Smith | ||||||||
Assigned To | Brad King | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | Mac | OS | OSX | OS Version | 10.8.4 | ||||
Product Version | CMake 2.8.11.2 | ||||||||
Target Version | CMake 2.8.12 | Fixed in Version | CMake 2.8.12 | ||||||
Summary | 0014291: Xcode generator incorrectly adds a custom command to a like-named target | ||||||||
Description | I have a set of rules I'm using to copy ("stage") some files after they're built. I do not want to use install rules for this for various reasons. The statements I'm using work great with the Makefile generator and the Visual Studio generator, but the build fails with the Xcode generator. Xcode tries to run the "stage" rule before it builds the target to be staged, even though the "stage" rule has a DEPENDS statement on the target. The build fails because the target does not exist: $ xcodebuild build -configuration RelWithDebInfo ... === BUILD NATIVE TARGET myapp OF PROJECT TestApp WITH CONFIGURATION RelWithDebInfo === Check dependencies PhaseScriptExecution "CMake Rules" TestApp.build/RelWithDebInfo/myapp.build/Script-2C3540A800314C1082C9261D.sh cd /Users/build/pds/xcode-test /bin/sh -c /Users/paul/xcode-test/TestApp.build/RelWithDebInfo/myapp.build/Script-2C3540A800314C1082C9261D.sh make: *** No rule to make target `/Users/paul/xcode-test/RelWithDebInfo/myapp', needed by `/Users/paul/xcode-test/dist/bin/myapp'. Stop. Command /bin/sh failed with exit code 2 ** BUILD FAILED ** The following build commands failed: PhaseScriptExecution "CMake Rules" TestApp.build/RelWithDebInfo/myapp.build/Script-2C3540A800314C1082C9261D.sh (1 failure) | ||||||||
Steps To Reproduce | Create a simple C file: cd ~ mkdir xcode-test cd xcode-test cat > myapp.c <<EOF #include <stdio.h> int main() { printf("Hello world!\n"); return 0; } EOF Then create a simple CMake file: cat > CMakeLists.txt <<EOF cmake_minimum_required(VERSION 2.8) project(TestApp C) add_executable(myapp myapp.c) set(MYPREFIX "${TestApp_SOURCE_DIR}/dist" CACHE PATH "install prefix" FORCE) add_custom_command(OUTPUT "${MYPREFIX}/bin/myapp" COMMAND "${CMAKE_COMMAND}" -E make_directory "${MYPREFIX}/bin" COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:myapp>" "${MYPREFIX}/bin" DEPENDS myapp COMMENT "Staging myapp to ${MYPREFIX}/bin" VERBATIM) add_custom_target("stage_myapp" ALL DEPENDS "${MYPREFIX}/bin/myapp") EOF Now build an Xcode generator, then run xcodebuild: $ cmake -G Xcode . $ xcodebuild build -configuration RelWithDebInfo | ||||||||
Additional Information | If you use the 'Unix Makefile' generator instead, it will work fine (even with high parallelism). Also I've tried replacing the "DEPENDS myapp" with a full pathname to "myapp" and that fails as well, with the same error. I've seen this same behavior on various different versions of Xcode: 4.1, 4.6, and 4.6.3 at least. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0033539) Brad King (manager) 2013-07-15 11:06 |
I can reproduce this even after removing the second target: -add_custom_target("stage_myapp" ALL - DEPENDS "${MYPREFIX}/bin/myapp") Somehow the custom command to copy myapp is ending up as one of the rules used to build myapp. If I change the name of the copied file to be "${MYPREFIX}/bin/myapp2" the problem goes away. |
(0033542) Brad King (manager) 2013-07-15 13:46 |
Fixed: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4bb6e248 [^] |
(0034645) Robert Maynard (manager) 2013-12-02 08:51 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2013-07-15 10:43 | Paul Smith | New Issue | |
2013-07-15 11:06 | Brad King | Note Added: 0033539 | |
2013-07-15 13:46 | Brad King | Note Added: 0033542 | |
2013-07-15 13:46 | Brad King | Assigned To | => Brad King |
2013-07-15 13:46 | Brad King | Status | new => resolved |
2013-07-15 13:46 | Brad King | Resolution | open => fixed |
2013-07-15 13:46 | Brad King | Fixed in Version | => CMake 2.8.12 |
2013-07-15 13:46 | Brad King | Target Version | => CMake 2.8.12 |
2013-07-15 13:46 | Brad King | Summary | add_custom_command() DEPENDS does not work with the Xcode generator => Xcode generator incorrectly adds a custom command to a like-named target |
2013-12-02 08:51 | Robert Maynard | Note Added: 0034645 | |
2013-12-02 08:51 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |