<div dir="ltr">Okay that makes sense. I will give ExternalProject_Add a try. I think it would be very useful if FetchContent were able to support targets with the same name and that would be a great feature to add (although it is understandable if it is a language limitation).<div><br></div><div>I much prefer the simplicity of FetchContent :)</div><div><br></div><div>Thanks,</div><div>Tim</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 20, 2019 at 8:22 AM Craig Scott <<a href="mailto:craig.scott@crascit.com">craig.scott@crascit.com</a>> 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"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 20, 2019 at 3:36 PM Timothy Wrona <<a href="mailto:tjwrona1992@gmail.com" target="_blank">tjwrona1992@gmail.com</a>> 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"><div dir="ltr">(Included cmake-developers list as well in case this may have just been something that should work that was overlooked with the FetchContent module)</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 19, 2019 at 11:32 PM Timothy Wrona <<a href="mailto:tjwrona1992@gmail.com" target="_blank">tjwrona1992@gmail.com</a>> 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"><div dir="ltr">I am having an issue with using FetchContent to grab two subprojects that both contain a "doxygen" target to build the documentation.<div><br></div><div>Both of these subprojects need to be able to be built independently and when built on their own they compile fine (along with their documentation), but when I pull them into one project using "FetchContent" I get an error saying I can't define the "doxygen" target more than once.</div><div><br></div><div>I imagine this kind of issue would come up all of the time when using a "superbuild" pattern. Is there a typical way of handling this?</div></div>
</blockquote></div></blockquote></div><div><br></div><div>I thought this limitation was already mentioned in the FetchContent docs, but it seems it isn't. If two different dependencies define the same global target name, then they cannot be combined into the same build via add_subdirectory(). CMake doesn't allow a target to be redefined (although it does allow additional commands to be added to an existing custom target). I'll try to add some docs to FetchContent to mention this limitation, but they will not make it into the 3.14 release - the limitation has always been there right from when FetchContent was first introduced in 3.11.</div><div><br></div><div>A traditional superbuild that uses ExternalProject won't have a problem with this because a subproject's own targets are not combined with targets of other subprojects into a single build. Instead, the top level project only sees the targets that ExternalProject itself creates. This is most likely the best workaround if you are not able to modify the target names used in the subprojects you want to combine.</div><div><br></div>-- <br><div dir="ltr" class="gmail-m_-3976835071602456189gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div><div><br></div><div>Get the hand-book for every CMake user: <a href="https://crascit.com/professional-cmake/" target="_blank">Professional CMake: A Practical Guide</a><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>