[CMake] cmake side effects: possible bug

Brad King brad.king at kitware.com
Thu Aug 24 14:34:10 EDT 2006


Michael Bell wrote:
> I have one more issue to deal with. I have been relying on
> CONFIGURE_FILE to set some variables as my scripts get copied. How can
> I integrate that into this framework? cmake -E copy does not seem to
> set the variables.

You can instead run "cmake -P somescript.cmake" to configure the file at
build time.  Arguments can be given to the script by setting variables
on the command line (before the -P):

${CMAKE_COMMAND} -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/myscript.pl.in
                 -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/myscript.pl
                 -DSOME_VAR=${SOME_VAR}
                 -P ${CMAKE_CURRENT_SOURCE_DIR}/configure_script.cmake

A completely different approach would be to make sure that
myscript.pl.in has execute permission in the source tree.  Then you can
just use CONFIGURE_FILE and the script will have execute permission in
the build tree.  Really there should be a way to set permissions using
the FILE command and also through CONFIGURE_FILE directly.  You can
submit a feature request here:

http://www.cmake.org/Bug

-Brad


More information about the CMake mailing list