[CMake] cmake side effects: possible bug

Brad King brad.king at kitware.com
Wed Aug 23 16:27:04 EDT 2006


Michael Bell wrote:
> All,
> 
> I am running cmake 2.4.3 on solaris.
> 
> In many of my subdirectories, I have commands to copy files to a
> release directory and make some of them executable:
> 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)
> 
> This worked for me in version 1.8, stopped working, and was re-added
> in 2.4.3. However, with the current version there is a problem when I
> run make in a subdirectory. It seems that even though I am in a
> subdirectory, files from every directory get moved. Only those files
> from the current subdirectory become executable. In other words, the
> CONFIGURE_FILE command gets called when it shouldn't be. I think if I
> run make from a subdirectory, other directories should not be
> affected. This was the behavior in version 1.8.

CMake now always runs globally, which makes most things MUCH easier to
implement.  There is no longer a "local generate" capability.

You can use CONFIGURE_FILE and EXECUTE_PROCESS to do this all at CMake time.

-Brad


More information about the CMake mailing list