[CMake] Generator "Visual Studio 7 .NET 2003" fails to generate custom commands properly when explicit WORKING_DIRECTORY is given

Gerhard Grimm ggrimm at detec.de
Thu Jan 18 06:08:31 EST 2007


Hi there!

Using cmake 2.4.6, I encountered a problem with the Visual Studio projects
generator and custom commands.

My CMAKE_SOURCE_DIR is D:/Projekte/OSLO/src
My CMAKE_BINARY_DIR is D:/Projekte/OSLO/build/win32debug

My CMakeLists.txt in source subdirectory INST contains:

add_custom_command(OUTPUT ${Pkg_setup_src}
                   COMMAND ${PYTHON} 
                   ARGS ${INST_TXTBUILD} ${Pkg_setup_src}
                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

where ${PYTHON} evaluates to an absolute Path:
D:/Projekte/OSLO/build/win32debug/python/2_4_x/python_d.exe

However, the project generator converts ${PYTHON} to a path relative to
CMAKE_CURRENT_BINARY_DIR, which would have worked fine if WORKING_DIRECTORY
had not been given. Alas, the generated command line for the above rule is:

cd D:\Projekte\OSLO\src\INST
..\python\2_4_x\python_d.exe D:/Projekte/OSLO/src/INST/txtbuild.py [...]

which is obviously going to fail, since the executable will not be found.
Is there a way to tell the generator to not mess up absolute paths?

Best regards,

Gerhard


More information about the CMake mailing list