[CMake] cmake side effects: possible bug

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Aug 27 17:13:53 EDT 2006


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.


Bill, just to make sure I am understanding your explanation, does that mean
the above ADD_CUSTOM_COMMAND in the foreach loop creates a large number of
different rules (one for each of the files in the SCRIPTS list) at cmake
time, all of which are executed at make time?

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list