[CMake] Re: Copying matching files

Hugo Costelha hugo.costelha at gmail.com
Tue Oct 3 10:56:45 EDT 2006


On Tuesday 03 October 2006 15:51, Hugo Costelha wrote:
> Hi,
>
> I need to copy all files that match a certain patter during compilation
> time. I am currenlty using the following in CMakeLists.txt:
>
> FILE(GLOB luts "lut*")
> FOREACH(file ${luts})
>     GET_FILENAME_COMPONENT(basename ${file} NAME)
>     ADD_CUSTOM_TARGET( luts ALL
>                        COMMAND ${CMAKE_COMMAND}
>                         -E copy ${file} ${LIBRARY_OUTPUT_PATH} )
> ENDFOREACH(file)
>
>
> However, there is a huge problem with this code. It creates fixed rules
> when running "cmake .", i.e., if I run "cmake .", then create a file lutA,
> then run make, it will not copy lutA, since it didn't exist when I ran
> cmake.
>
> Does anyone know of a good alternative to do this, that really performs
> something like "cp lut* <location>"?
>

I forgot to say, that I also tryed something using  "cmake -E copy lut*", 
but "cmake -E copy" cannot copy more than one file.

Hugo Costelha


More information about the CMake mailing list