[CMake] WORKING_DIRECTORY ignored for ADD_CUSTOM_COMMAND on Visual Studio?
Martin Apel
martin.apel at simpack.de
Thu Jun 26 09:53:29 EDT 2008
Hi Bill
I simply do the following:
ADD_CUSTOM_COMMAND(OUTPUT ${FSrcWithBinDir}
${CMAKE_CURRENT_BINARY_DIR}/accessor_protos.h
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/FortranModules.inp
${CMAKE_CURRENT_BINARY_DIR}/FortranModules.inp
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/FortranCommons.inp
${CMAKE_CURRENT_BINARY_DIR}/FortranCommons.inp
COMMAND ${PERL_EXECUTABLE}
${CMAKE_SOURCE_DIR}/scripts/createFortAccessors.pl
DEPENDS
${CMAKE_SOURCE_DIR}/scripts/createFortAccessors.pl FortranModules.inp
FortranCommons.inp ${ModuleDefs} ${CommonDefs}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
This calls a perl script to generate a bunch of Fortran files as needed.
This script has to run in the output directory. I have checked the
generated .vcproj file and it doesn't contain anything related to
the working directory for this command. I modified the command to use
COMMAND ${CMAKE_COMMAND} -E chdir ${PERL_EXECUTABLE}
${CMAKE_SOURCE_DIR}/scripts/createFortAccessors.pl
and now it works properly. But still, my impression is, that the Visual
Studio generator ignores this parameter.
Regards,
Martin
Bill Hoffman wrote:
> Martin Apel wrote:
>> Hi all,
>>
>> 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?
>>
> Might be a bug, might be you. Please provide a small example that
> shows the problem.
>
> -Bill
>
--
Martin Apel Tel: 0049 8153 9288-47
Software Architect E-Mail: martin.apel at simpack.de
INTEC GmbH Tel: 0049 8153 9288-0
Argelsrieder Feld 13 Fax: 0049 8153 9288-11
82234 Wessling E-Mail: intec at simpack.de
Germany URL: http://www.simpack.com
More information about the CMake
mailing list