The following issue has been SUBMITTED. ====================================================================== http://cmake.org/Bug/view.php?id=11938 ====================================================================== Reported By: strcasecmp Assigned To: ====================================================================== Project: CMake Issue ID: 11938 Category: CMake Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2011-03-08 01:30 EST Last Modified: 2011-03-08 01:30 EST ====================================================================== Summary: CMake ADD_CUSTOM_COMMAND with working directory problem in Visual Studio 2010 Description: Apparently (based on my searches) in Visual Studio 2010, all custom build targets for a given project get executed within the same batch file generated by VS. As a result, if a cmake custom command has a working directory set, the resultant "cd" in the build rule can interfere with subsequent custom build rules.
This becomes a problem that can't be easily worked-around when building Qt projects (the Qt macros create their own custom commands). In the Qt example, I was able to confirm that the "cd" was the cause by adding a cd back to the ${CMAKE_CURRENT_BINARY_DIR} at the start of the failing custom command, or by modifying the QT4_CREATE_MOC_COMMAND macro to avoid using the WORKING_DIRECTORY. Steps to Reproduce: For simplest reproduction (though, not the only way), the attached sample may be used. To cause this sample to trigger the problem, cmake must be run from a location within this project directory. This causes a relative path to be used for the cmake command used in the CMakeLists.txt custom build tool. The layout is as follows: simple/ simple/hello.in simple/CMakeLists.txt simple/build/ Extract/copy cmake into the simple/ directory and run from the build subdirectory: ..\cmakedir\bin\cmake-gui.exe .. Generate a VS2010 project/solution. Then attempt to build the resultant solution. Additional Information: This could probably be easily (and probably correctly) solved by having the VS2010 generator do a cd back to the current binary directory at the end of each custom command (or a pushd/popd pair). ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2011-03-08 01:30 strcasecmp New Issue 2011-03-08 01:30 strcasecmp File Added: simple.zip ====================================================================== _______________________________________________ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers