Hi all, I am stuck on a problem with generated object files: I have an external application that builds object files out of a proprietary source format. Inside a single CMakeLists.txt I can invoke this application via add_custom_command and then feed the object file into add_executable/add_library just fine.
Now I'd like to share one generated object file (which is time-consuming to build) between multiple sub-CMakeLists.txt (each CMakeLists.txt builds a target that should link in this object file): 1. I tried to wrap the result of add_custom_command in an OBJECT library but found that cmake 2.8.10 doesn't like this (OBJECT library "myobjectlib" contains: MyObject.o but may contain only headers and sources that compile.) 2. The best solution I have found so far is to create a target with add_custom_target that depends on the object file. Then I can set PROPERTY GENERATED for this object to true in my sub-CMakeLists.txt and make the targets that use the object file depend on the files corresponding custom target. While the second option seems to work, it is much more complicated than just adding an additional source or a $<TARGET_OBJECTS...> entry to an add_executable/add_library call. This concerns me because I'd like to wrap all the custom command/custom target code in a CMake function so that it will be easy to use for users of the proprietary tool. Is there a better way to share generated object files between targets in different CMakeLists.txt? Is there a plan for future versions of CMake to support external objects inside OBJECT libraries? Any help is greatly appreciated. Cheers, Stefan -- 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