<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 13, 2018 at 9:46 PM Andrew White <<a href="mailto:andrew.white@audinate.com">andrew.white@audinate.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 lang="EN-AU">
<div class="gmail-m_-498348311823470717WordSection1">
<p class="gmail-m_-498348311823470717MsoPlainText">J Decker wrote:<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText" style="margin-left:36pt">You can define a variable to define the base of the sources....<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText" style="margin-left:36pt">set( SOURCE_ROOT /some/path )<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText" style="margin-left:36pt"><u></u> <u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText" style="margin-left:36pt">could be set relative to the current cmake path per cmake that uses those<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText" style="margin-left:36pt">souces... and then just prefix it<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText" style="margin-left:36pt"><u></u> <u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText" style="margin-left:36pt">add_library(my_lib<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText" style="margin-left:36pt">        ${SOURCE_ROOT}/src/a.c<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText" style="margin-left:36pt">        ${SOURCE_ROOT}/include/a.h<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText" style="margin-left:36pt">)<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText"><u></u> <u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText">Thanks, but that’s approximately exactly what I’m trying to avoid doing.  I cheat a little, in that I have a macro that will prepend a prefix to every element of a list.  My motivation is avoiding situations where I add the prefix to
 the files but forget to add the prefix when I call target_include_directories or suchlike.<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText"><u></u> <u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText">I’m not sure anything trickier is workable in the CMake model, however.  For example, hacking CMAKE_CURRENT_SOURCE_DIR might make sense for file paths, but if I then call add_subdirectory should it be rooted at the CMakeList directory
 or the source root directory.<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText"><u></u> </p></div></div></blockquote><div>CMAKE_CURRENT_LIST_DIR</div><div><a href="https://stackoverflow.com/questions/15662497/difference-between-cmake-current-source-dir-and-cmake-current-list-dir">https://stackoverflow.com/questions/15662497/difference-between-cmake-current-source-dir-and-cmake-current-list-dir</a><br></div><div><br></div><div>yes that's an option also.</div><div>It will be pretty clear there's an error if something is omitted later; and/or referenced from a different place.</div><div> and then it's not just a matter of </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"><div lang="EN-AU"><div class="gmail-m_-498348311823470717WordSection1"><p class="gmail-m_-498348311823470717MsoPlainText"><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText">--<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText">Andrew<u></u><u></u></p>
<p class="gmail-m_-498348311823470717MsoPlainText"><u></u> <u></u></p>
</div>
</div>

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