On Tuesday 03 October 2006 17:03, Hugo Costelha wrote: > On Tuesday 03 October 2006 16:07, you wrote: > > Hugo Costelha wrote: > > > 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>"? > > > > 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? >
Ok, I found out I can add "-DLIBRARY_OUTPUT_PATH=${LIBRARY_OUTPUT_PATH}" to the ADD_CUSTOM_TARGET in order to specify the var. Thanks again for the help, Hugo Costelha _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake