Fwd: Re: [CMake] Copying matching files
Hugo Costelha
hugo.costelha at gmail.com
Tue Oct 3 14:14:04 EDT 2006
On Tuesday 03 October 2006 17:45, Brad King wrote:
> Hugo Costelha wrote:
> > On Tuesday 03 October 2006 16:07, you wrote:
> >> You can add a custom target that runs
> >>
> >> cmake -P myscript.cmake
> >>
> >> and then put the glob/copy code in the script. In the script use
> >> EXECUTE_PROCESS to call cmake -E copy in a FOREACH on the result of the
> >> glob.
> >
> > Thanks for the quick reply. However, I still have a problem. Running the
> > script, it has no knowledge of ${LIBRARY_OUTPUT_PATH}, which has been
> > defined previously. Can I pass some arguments, or something?
>
> You can pass arguments:
>
> cmake -DMYVAR=myval -P myscript.cmake
>
> The -D options have to come before the -P option.
>
Yeah, it worked like this, thanks.
> Since you might have to set several values it may be simpler to use
> CONFIGURE_FILE to configure the script with the proper values already in
> place:
>
> # myscript.cmake.in
> SET(LIBRARY_OUTPUT_PATH "@LIBRARY_OUTPUT_PATH@")
> ...
>
> # CMakeLists.txt
> CONFIGURE_FILE(
> ${CMAKE_CURRENT_SOURCE_DIR}/myscript.cmake.in
> ${CMAKE_CURRENT_BINARY_DIR}/myscript.cmake
> @ONLY IMMEDIATE
> )
>
> What are you copying that needs LIBRARY_OUTPUT_PATH? There may be
> another way to accomplish your goal.
>
They are some configuration files. They can be added at any time, and any
available one can be used in run time. The LIBRARY_OUTPUT_PATH is used just
because it makes sense for us, but a different location could be use, it is
not because it is a Library per se.
Thanks again,
Hugo Costelha
More information about the CMake
mailing list