[CMake] Problems using add_custom_command and perl

Maxime Lecourt maxime.lecourt at gmail.com
Thu Apr 21 09:48:36 EDT 2011


Hi,

I'm currently trying to use add_custom_command, but I do not get any output
(it's working fine in other projects, with Bison and Flex).

Basically, I have a CMakeLists.txt file with

include(CMakeCallPerl.cmake)
PERL_SCRIPT("${GLISS_PATH}/nmp2nml.pl" "ppc.nmp")


And in my CMakeCallPerl.cmake file :

find_program(PERL perl)
IF(PERL)
    MACRO(PERL_SCRIPT SCRIPT FILENAME)
    GET_FILENAME_COMPONENT(PATH "${FILENAME}" PATH)
    GET_FILENAME_COMPONENT(PREFIX "${FILENAME}" NAME_WE)
    SET(OUTFILE "${PREFIX}.nml")
    MESSAGE(STATUS "${PERL} ${SCRIPT} ${FILENAME} ${OUTFILE}")
    ADD_CUSTOM_COMMAND(
        OUTPUT "${OUTFILE}"
        COMMAND "${PERL}"
        "${SCRIPT}"
        "${FILENAME}"
        "${OUTFILE}"
    )
    SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" PROPERTIES GENERATED TRUE)
    ENDMACRO(PERL_SCRIPT)
ENDIF(PERL)

What am I doing wrong ?

Copy/Pasting the MESSAGE output in command line, everything works fine, but
not when compiling after generating with CMake.
(it looks like this :
C:/Win16App/rational/TestRealTime/bin/intel/win32/perl.exe
D:/workspace/ppc/../gliss/nmp2nml.pl ppc.nmp ppc.nml)
There is also no mention for Perl in any CMake generated file.
Using Windows XP and MinGW

Regards,

Maxime
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110421/e69dd389/attachment.htm>


More information about the CMake mailing list