[CMake] cmake side effects: possible bug

Michael Bell michael.bell at acm.org
Thu Aug 24 12:12:44 EDT 2006


Brad,

Ok, it certainly makes sense that running cmake globally would
simplify things, which is a good thing. It does seem to cause a
problem for me that maybe you can help me work around:

Say I have a several subdirectories, each with C++ code and perl
wrappers to that code. If I change the code in one directory and run
make, it compiles the code, then ALL perl files are copied, but only
the files from the current directory are made executable. So, while I
had executable perl wrappers before, they are no longer executable
except from the one directory.

The solution I have adopted for now is to run make from the root,
which copies and makes all scripts executable. But, that means C++
code must be compiled in every directory too, even if I don't want
that to happen. Or, perl scripts get copied that I don't want copied
yet. In other words, I need a way for make to act locally.

Note that I am running cmake only once, before any of the above.
Everything I wrote about happens when I run make.

thanks,
michael

On 8/23/06, Brad King <brad.king at kitware.com> wrote:
> 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
>


-- 
michael.bell at acm.org


More information about the CMake mailing list