[CMake] Generate headers and inherit include_directories

Michael Ellery mellery451 at gmail.com
Tue Oct 3 13:02:57 EDT 2017


maybe a CMake snippet of what you are trying would help clarify, but are you using an interface library for your header-only? I would assume yes - and then have to tried add_dependency() for that library to trigger the file generation? The dependency will only be resolved when the library is used by an exe or installed (I think), but that should be sufficient?

-Mike

> On Oct 3, 2017, at 6:54 AM, Nagy-Egri Máté Ferenc via CMake <cmake at cmake.org> wrote:
> 
> Hi!
> 
> I am a seasoned Cmake user but cannot solve a fairly simple problem, so I might be mistaking the forest for the trees.
> 
> I have a project in which there is a custom_command/custom_target pair that creates a header file as part of a (currently) header-only target. I want to create an imported target (or really, any kind of target), which is responsible for triggering header generation at build time AND relaying the include directory so consumers need not worry about the location where the generated header files go. My problem is:
> 
> 	• I cannot invoke target_include_directories on a custom_target
> 	• Imported targets cannot have source files (for proper depending on the result header file)
> 	• Imported targets cannot link to a custom_target
> 	• Interface and Unkown libraries cannot be non-imported
> 	• All other library types result in objects/libraries (which I don’t need)
> 
> How can I create the dependency graph where my custom_command is invoked if the inputs to it change (or if its output doesn’t exist yet) and depending targets are rebuilt accordingly AND I also inherit build properties (include directories)?
> 
> Cheers,
> Máté
> --
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171003/e896b798/attachment.sig>


More information about the CMake mailing list