<div dir="ltr"><div dir="ltr">(Please continue to CC the mailing list with replies)</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 11, 2019 at 4:22 PM Stéphane Ancelot <<a href="mailto:sancelot@numalliance.com">sancelot@numalliance.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p><br>
</p>
<div class="gmail-m_1615156386250128571moz-cite-prefix">Le 10/04/2019 à 23:03, Craig Scott a
écrit :<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr"><br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Apr 11, 2019 at 1:35
AM Stéphane Ancelot <<a href="mailto:sancelot@numalliance.com" target="_blank">sancelot@numalliance.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Hi,</p>
<p>are there any specific Cmake configurations to setup in
projects when using fetchcontent.</p>
<p>I am able to fetch and build a library but not able to
link and include files of this library in another
projects.</p>
<p>include(FetchContent)<br>
<br>
FetchContent_Declare(<br>
jconcpp<br>
GIT_REPOSITORY <a class="gmail-m_1615156386250128571gmail-m_-7671476006035390538moz-txt-link-freetext" href="https://github.com/joncol/jcon-cpp.git" target="_blank">https://github.com/joncol/jcon-cpp.git</a><br>
)<br>
<br>
FetchContent_Populate(jconcpp)<br>
add_subdirectory(${jconcpp_SOURCE_DIR}
${jconcpp_BINARY_DIR})</p>
</div>
</blockquote>
</div>
</div>
</blockquote>
add_subdirectory(projA)<br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div>Can you provide a complete minimal example which shows
the problem? The snippet above should bring jsoncpp into
your main build, but without seeing how you are trying to
link to it's targets, it is hard to tell what the problem
could be.</div>
<div> </div>
</div>
</div>
</blockquote>
<p>fetchcontent is done in the main CMakeLists.txt</p>
<p>I have a projA dir</p>
<p>projA/CMakeLists.txt</p>
<p>cmake_minimum_required(VERSION 3.10)<br>
project(proja)<br>
<br>
add_executable(proja<br>
proja.cpp)<br>
<br>
target_link_libraries(proja jconcpp)<br></p></div></blockquote></div><div>There is no target in the jcon-cpp project by the name "jconcpp". The only library I can see in that project is one called "jcon". Note that you need to link against CMake targets, not against the dependency name used in the call to FetchContent_Declare().</div><div><br></div><div><br></div><div><br></div>-- <br><div dir="ltr" class="gmail_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>