[CMake] WORKING_DIRECTORY ignored for ADD_CUSTOM_COMMAND on Visual Studio?

Pau Garcia i Quiles pgquiles at elpauer.org
Fri Jun 27 10:47:22 EDT 2008


Quoting Martin Apel <martin.apel at simpack.de>:

> I got the impression, that the CMake generator for Visual Studio 7
> ignores the working directory set in ADD_CUSTOM_COMMAND. Is this a bug
> or is this a documented feature somehow?
> Or am I simply doing something wrong?

Incidentally, I'm suffering this same issue when building Strigi from  
kdesupport on Windows using Visual C++ 2005, as I said in   
http://article.gmane.org/gmane.comp.kde.windows/296

====================
From: Pau Garcia i Quiles <pgquiles at ...>
Subject: Building Strigi on Windows
Newsgroups: gmane.comp.kde.windows
Date: 2008-06-24 23:56:05 GMT (2 days, 14 hours and 48 minutes ago)

Hello,

Building Strigi on Windows fails for me if Java is installed.

The relevant part is trunk/kdesupport/strigi/src/xsd/CMakeLists.txt
lines 39 to 84. When Java 1.5+ is installed, the files
metadataproperties.h, metadataproperties.cpp and
metadatapropertiestest.cpp are regenerated but they are created in
CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_CURRENT_BINARY_DIR.

I've done some testing and it's like CMake is ignoring the
WORKING_DIRECTORY parameter because whatever I set as
WORKING_DIRECTORY, the files are always generated in
CMAKE_CURRENT_SOURCE_DIR. I have been unable to reproduce this
behavior, though.

I've tested both CMake 2.4.8 and CMake 2.6.0. Java version is Sun's
1.6.0_06 and I'd say it's working fine. No, I have not tried on Linux
(yet).
====================

The CMake code looks fine to me:

add_custom_command(
       OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${XSDNAME}.cpp"
              "${CMAKE_CURRENT_BINARY_DIR}/${XSDNAME}.h"
              "${CMAKE_CURRENT_BINARY_DIR}/${XSDNAME}test.cpp"
       COMMAND ${JAVA_COMPILE} -d ${CMAKE_CURRENT_BINARY_DIR}
              "${CMAKE_CURRENT_SOURCE_DIR}/xsdparser/xsdparser.java"
       COMMAND ${JAVA_RUNTIME} -cp ${CMAKE_CURRENT_BINARY_DIR}
			 xsdparser.xsdparser ${XSDFILE}
       DEPENDS xsdparser/xsdparser.java ${XSDFILE}
       WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})


(full CMakeLists.txt:  
http://websvn.kde.org/trunk/kdesupport/strigi/src/xsd/CMakeLists.txt?revision=814016&view=markup  
)


-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)



More information about the CMake mailing list