<div dir="ltr"><br><div>> <span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span> </span>I also wasn't able to find a way to get a list of targets a given target depends on, so that I could run through it and query each dependent target's custom property manually.</span></div><div><span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br>This isn't currently possible.</span></div><div><span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> <span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">The executable targets need to collect the shader files and headers of only the libraries they depend on in order to compile them</span></span></div><div><span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></span></div><div>Have you looked at using `target_sources`? In general target_sources are transitive and allow you to include source files for compilation for your consumers, when you combine them generator expressions you make the inclusion conditional. A great example would be how Qt5 conditionally includes sources when it encounters an executable on windows ( <a href="https://github.com/qt/qtbase/blob/17b73b0d2b8e0d643bdf13b543cc23d657a4b330/src/corelib/Qt5CoreConfigExtras.cmake.in#L160">https://github.com/qt/qtbase/blob/17b73b0d2b8e0d643bdf13b543cc23d657a4b330/src/corelib/Qt5CoreConfigExtras.cmake.in#L160</a> ).<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, May 9, 2018 at 11:55 AM Marek Vojtko (Firaxis) <<a href="mailto:Marek.Vojtko@firaxis.com">Marek.Vojtko@firaxis.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I have multiple library targets that each provide shader files and headers. I also have multiple executable targets that each depend on a different set of these library targets. The executable targets need to collect the shader files and headers of only the libraries they depend on in order to compile them.<br>
<br>
The ideal solution would be to reproduce the transitive dependency behavior controlled by target_link_libraries on a custom target property [0], but as far as I can tell define_property does not do that - it just creates a property on a target that can be queried but is not part of the dependency chain. I also wasn't able to find a way to get a list of targets a given target depends on, so that I could run through it and query each dependent target's custom property manually.<br>
<br>
Variables do not solve this problem, because different executables depend on different libraries. Each library would need to know a) about all executables, and b) whether a particular executable depended on said library in order to be able to add the shader files and headers to a per-executable variable.<br>
<br>
Is there a way to achieve this in CMake?<br>
<br>
[0] CMake has a set of properties that get propagated according to the transitive dependency rules (PRIVATE, INTERFACE, PUBLIC) using target_link_libraries (e.g. COMPILE_DEFINITIONS, COMPILE_OPTIONS, INCLUDE_DIRECTORIES, etc.). I would like to add a custom property, for example SHADER_SOURCES, and have it propagate the same way, i.e. target A that depends on targets B, C, and D would have the INTERFACE_SHADER_SOURCES of targets B, C, and D in its SHADER_SOURCES property.<br>
--<br>
Marek Vojtko<br>
mail: <a href="mailto:marek.vojtko@firaxis.com" target="_blank">marek.vojtko@firaxis.com</a><br>
phone: (+1) 410-229-2519<br>
<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>