[CMake] [CMAKE] Handling External Libraries and Resources
Clinton Stimpson
clinton at elemtech.com
Wed May 12 23:58:27 EDT 2010
>
> Essentially, I'd like to hear your views on handling resource copying. Is
> there an obvious method I've overlooked? What are other projects doing to
> handle resources? Any ideas with respect to other methods of handling resources?
You could do your resources like this:
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(inres ${CMAKE_CURRENT_SOURCE_DIR}/myres.txt)
set(outres ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/myres.txt)
add_custom_command(OUTPUT "${outres}"
COMMAND "${CMAKE_COMMAND}" -E copy "${inres}" "${outres}")
add_library(foo foo.cpp ${outres})
The custom command will be part of building the library, and will run anytime myres.txt is out-of-date.
You could make a macro or function if you need to repeat that code often.
Also, installers can easily be made with things scattered around a build tree. The cmake install() commands help you put it where you want in the installer. So, I suggest saving your install() commands for making installers, not for handling external libraries.
Clint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100512/f68b1f18/attachment.htm>
More information about the CMake
mailing list