Hi,

>-----Original Message-----
>From: Michael Wild [mailto:them...@gmail.com]


>Problem is the following:
>
>Dependencies between stuff in different directories only work for top-
>level targets (add_library, add_executable and add_custom_target). So,
>you would need to add a ADD_CUSTOM_TARGET call with a unique target name
>in your ADD_SOURCES function, add that name to a global list (as you do
>with the sources) and then after your ADD_EXECUTABLE call you have to do
>an ADD_DEPENDENCIES. Further, you need to tell CMake at the top-level
>that the sources are generated by setting the source file property
>GENERATED to TRUE.

OK. Indeed, we found it was possible to create an empty target, adding 
subdirectories, obtaining the global src list, adding a library based on the 
src list for which source file properties were set to GENERATED 1 and adding a 
dependency between the lib and the custom target worked. add_sources() was 
modified to add local custom targets and add dependencies to the top level 
target on the fly. 

This is in the cmake wiki and it seems rather hackish, but against better 
judgement we moulded it a bit anyway ;) 
http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_add_a_dependency_to_a_source_file_which_is_generated_in_a_subdirectory.3F


>All very complicated and error prone. So I suggest, you move the whole
>logic of your preprocessing to your top-level CMakeLists.txt file.
>

Thanks. I would much prefer something clean like that, although I think that 
wrapping the entire process in add_Sources() has reduced the chances of errors. 
I'm looking to make the CMakeLists.txt files as readable as possible, and 
offloading the functionality to a functions.cmake file, or so. The lib builds 
now, hopefully I can assemble the binary tomorrow. :)

When it gets to the top level target, make chokes somewhat, but I guess that's 
to be expected, I'll see tomorrow about make -j x.

Thanks Michael.

Regards,
Arjen
_______________________________________________
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