[CMake] cmake side effects: possible bug

Michael Bell michael.bell at acm.org
Sun Aug 27 18:03:21 EDT 2006


On 8/27/06, Alan W. Irwin <irwin at beluga.phys.uvic.ca> wrote:
> On 2006-08-27 16:30-0400 William A. Hoffman wrote:
>
> > At 12:00 PM 8/27/2006, Steve Johns wrote:
> >> Michael Bell wrote:
> >>>> ADD_CUSTOM_TARGET(makeExecutable ALL)
> >>>> FOREACH(file ${SCRIPTS})
> >>>>   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}
> >>>>       ${EXECUTABLE_OUTPUT_PATH}/../${file}
> >>>>       @ONLY)
> >>>>   ADD_CUSTOM_COMMAND(
> >>>>       TARGET makeExecutable
> >>>>       POST_BUILD
> >>>>       COMMAND chmod
> >>>>       ARGS +x ${EXECUTABLE_OUTPUT_PATH}/../${file}
> >>>>       )
> >>>> ENDFOREACH(file)
> >>
>
> > [...] So, in the above example, the foreach and configure_file will run
> > when cmake is run on the project, and not when make is run.  The custom
> > target will run when make is run but not the foreach and configure_file.

I would like to point out that in practice, you would edit a file and
call make. Since a file would change, this triggers a global cmake
call, running the configure_file command for every directory and the
custom target for just the local directory.

michael

-- 
michael.bell at acm.org


More information about the CMake mailing list