> Date: Sat, 15 May 2010 07:48:54 +0200
> From: [email protected]
> To: [email protected]
> Subject: Re: [CMake] [CMAKE] Handling External Libraries and Resources
>
> On 05/13/2010 05:58 AM, Clinton Stimpson wrote:
>>>
>>> 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.
>
> To achieve this, there must be a dependency of ${outres} on ${inres}:
>
> add_custom_command(OUTPUT "${outres}"
> COMMAND "${CMAKE_COMMAND}" -E copy "${inres}" "${outres}"
> DEPENDS "${inres}")
>
> Otherwise, ${outres} is not processed anew if ${inres} changes.
>
> Regards,
>
> Michael

This cleans up our custom target hack quite nicely and makes this 
process more transparent to a developer writing code. It still requires a
 bunch of management within cmake but we can live with that.



Thanks for the tips,

Patrik

                                          
_________________________________________________________________
Win a $10,000 shopping spree from Hotmail! Enter now.
http://go.microsoft.com/?linkid=9729711
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to