[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    Re: [CMake] target_sources vs. PUBLIC_HEADER for libraries
From:       Alex Turbov <i.zaufi () gmail ! com>
Date:       2019-10-11 21:09:03
Message-ID: CANktQtseKJdkXgOwaAKsTqkE64TgoZxWhEYLNe9uKHoX-z10Xw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

On Fri, Oct 11, 2019 at 9:33 PM Michael Ellery <mellery451@gmail.com> wrote:

> I'd like to make sure I understand two different aspects of header files
> management for libraries:
>
> (1) typically you can add header files to target_sources, but it's only
> helpful for IDEs..so that the IDE will show the header files in its sources
> list, correct?. In theory, cmake does not actually need header files
> explicitly specified for dependency tracking, although I guess listing them
> makes it explicit.
>

yep, correct


> (2) setting the PUBLIC_HEADER property for a target then makes header
> files available for installation via the PUBLIC_HEADER destination. Is this
> the preferred way to install the library interface/public headers? How do
> you handle a header directory hierarchy — for example maybe you have detail
> and impl subdirectories if you are following boost/stdlib conventions.
>
>
Nowadays this feature useless if you have a directory hierarchy %( So
pity...


> I found Craig's article about target_sources very helpful (
> https://crascit.com/2016/01/31/enhanced-source-file-handling-with-target_sources/),
> but I don't think it addresses the PUBLIC_HEADER installation use case.
>

Yep, it describes a trivial ("Hello World" level) projects.

Some time ago I've started a discussion about improvements to
`target_sources` addressed to resolve directory hierarchy install problem,
but it ends w/ no outcome... %(


> Thanks,
> Mike Ellery
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>

[Attachment #5 (text/html)]

<div dir="ltr"><div dir="ltr">Hi,<br></div><br><div class="gmail_quote"><div \
dir="ltr" class="gmail_attr">On Fri, Oct 11, 2019 at 9:33 PM Michael Ellery &lt;<a \
href="mailto:mellery451@gmail.com">mellery451@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I'd like to make sure \
I understand two different aspects of header files management for libraries:<br> \
<br>(1) typically you can add header files to target_sources, but it's only helpful \
for IDEs..so that the IDE will show the header files in its sources list, correct?. \
In theory, cmake does not actually need header files explicitly specified for \
dependency tracking, although I guess listing them makes it \
explicit.<br></blockquote><div><br></div><div>yep, correct<br></div><div> \
<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br>(2) setting the \
PUBLIC_HEADER property for a target then makes header files available for \
installation via the PUBLIC_HEADER destination. Is this the preferred way to install \
the library interface/public headers? How do you handle a header directory hierarchy \
— for example maybe you have detail and impl subdirectories if you are following \
boost/stdlib conventions.<br> <br></blockquote><div><br></div><div>Nowadays this \
feature useless if you have a directory hierarchy %( So pity...<br></div><div>  \
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex">I found Craig's article about target_sources \
very helpful (<a href="https://crascit.com/2016/01/31/enhanced-source-file-handling-with-target_sources/" \
rel="noreferrer" target="_blank">https://crascit.com/2016/01/31/enhanced-source-file-handling-with-target_sources/</a>), \
but I don't think it addresses the PUBLIC_HEADER installation use \
case.<br></blockquote><div><br></div><div>Yep, it describes a trivial (&quot;Hello \
World&quot; level) projects.</div><div><br></div><div>Some time ago I&#39;ve started \
a discussion about improvements to `target_sources` addressed to resolve directory \
hierarchy install problem, but it ends w/ no outcome... \
%(</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br>Thanks,<br>Mike \
Ellery<br>-- <br> <br>Powered by <a href="http://www.kitware.com" rel="noreferrer" \
target="_blank">www.kitware.com</a><br> <br>Please keep messages on-topic and check \
the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" \
target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br> <br>Kitware offers \
various services to support the CMake community. For more information on each \
offering, please visit:<br> <br>CMake Support: <a \
href="http://cmake.org/cmake/help/support.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/support.html</a><br>CMake Consulting: <a \
href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>CMake Training \
Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/training.html</a><br> <br>Visit other \
Kitware open-source projects at <a \
href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" \
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br> <br>Follow \
this link to subscribe/unsubscribe:<br> <a \
href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" \
target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br> \
</blockquote></div></div>



-- 

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:
https://cmake.org/mailman/listinfo/cmake



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic