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@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

Attachment: signature.asc
Description: Message signed with OpenPGP

-- 

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

Reply via email to