[CMake] Calling cmake from within cmake.

Sylvain Benner benner at virtools.com
Mon Oct 8 12:37:42 EDT 2007


>
>
> In the mean time I'm doing,
>
>     EXEC_PROGRAM(${CMAKE_COMMAND} ${CONFIG_SUBDIR}/${CONFIG}
>         ARGS -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=${CONFIG}
> -DBUILD_SUBTREE=1
>         ${CMAKE_HOME_DIRECTORY}
>     )
>
> However that doesn't work because the double quotes aren't escaped.  How
> do I escape quotes in cmake?
>   
To better answer to your problem, here is the corrected string:

    EXEC_PROGRAM(${CMAKE_COMMAND} ${CONFIG_SUBDIR}/${CONFIG} ARGS "-G \"NMake Makefiles\"" "-DCMAKE_BUILD_TYPE=${CONFIG}"
"-DBUILD_SUBTREE=1" ${CMAKE_HOME_DIRECTORY})


Bty the way, EXECUTE_PROCESS should be used instead or EXEC_PROGRAM, it 
is a more powerful command.

--Sylvain



More information about the CMake mailing list