MantisBT - CMake
View Issue Details
0014691CMakeCMakepublic2014-01-09 14:202016-06-10 14:31
tron_thomas 
Kitware Robot 
normalminoralways
closedmoved 
MacintoshOS X10.7.5
CMake 2.8.12 
 
0014691: Post build phase to delete directory fails in Xcode project
If someone creates a post build phase command to delete a directory, that command will fail when executed in Xcode
Create a very simple Hello World code module. Create a directory that can be deleted
Use a CMakeLists.txt file like the following to create an Xcode project to build the Hello World application:

cmake_minimum_required (VERSION 2.8)

project (HelloWorld)

add_executable (HelloWorld HelloWorld.cpp)

add_custom_command (
    TARGET HelloWorld
    POST_BUILD
    COMMAND cmake -E remove_directory <Path to directory that will be deleted>
)

Create and build the Xcode project.

Expected:
The project should build without errors

Actual:
Even though the directory exists and the path to it is valid, the following error will occur in Xcode
make: cmake: No such file or directory
Using Xcode version 4.6.3
This problem will not happen if someone creates an UNIX makefile project instead of Xcode. Everything builds successfully
No tags attached.
Issue History
2014-01-09 14:20tron_thomasNew Issue
2014-01-09 14:32Nils GladitzNote Added: 0034921
2015-01-14 13:13tron_thomasNote Added: 0037692
2015-01-14 13:19Brad KingNote Added: 0037693
2016-06-10 14:29Kitware RobotNote Added: 0042462
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0034921)
Nils Gladitz   
2014-01-09 14:32   
"make: cmake: No such file or directory" looks like it can not find "cmake".
Can you try ${CMAKE_COMMAND} -E instead?
(0037692)
tron_thomas   
2015-01-14 13:13   
This is problem that Xcode cannot find the cmake executable. Xcode does not inherit a user environment, so if CMake is installed and configured to work from the command line, Xcode can still fail to find it.

A possible work around is for someone to create a symbolic link to cmake in /usr/bin which is a standard path location Xcode will look for applications.

It seem it would be better if the full path to cmake can be specified when using the add_custom_command. This can vary on different systems so it would be something CMake would have to do rather than a script author.
(0037693)
Brad King   
2015-01-14 13:19   
Re 0014691:0037692: The suggestion in 0014691:0034921 to use ${CMAKE_COMMAND} will produce a full path.
(0042462)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.