Hi all,

the WORKING_DIRECTORY from add_custom_target() does change the current directory properly on windows, if the current directory and the directory specified in WORKING_DIRECTORY reside on different drives.
I experienced that with the following command:

add_custom_target(doc
echo "*** CD-ing:" cd && ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    COMMENT "Generating API documentation" VERBATIM
)

which is executed as

[  0%] Generating API documentation
cd D:\develop\ITE\client_automation\src\itecrc-lib && echo "*** CD-ing:" && cd && "C:/Program Files (x86)/doxygen/bin/doxygen.exe" C:/Users/m.weber/Documents/.eclipsews/ITE/client_automation/src/itecrc-lib/Doxyfile
"*** CD-ing:"
C:\Users\m.weber\Documents\.eclipsews\ITE\client_automation

I expect
D:\develop\ITE\client_automation\src\itecrc-lib
here.
There problem is caused by the cd-command on windows: To change the current directory _and_ the drive, the /D option must be specified.
So 'WORKING_DIRECTORY Z://foo' should translate to
'cd /D  Z://foo' on windows to make it work.

Regards,
 Martin

--
E-Mails sollten Text sein, Text und nur Text.
Wenn Gott gewollt hätte, dass E-Mails in HTML geschrieben würden,
endeten Gebete traditionell mit </amen>.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to