<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 12, 2018 at 7:22 PM Andrew White <<a href="mailto:andrew.white@audinate.com">andrew.white@audinate.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have a situation where I want my CMakeLists.txt in a different place than my source.<br>
<br>
e.g.:<br>
<br>
/some/path/project/CMakeLists.txt<br>
/other/path/source/src/a.c<br>
/other/path/source/include/a.h<br>
<br>
Is there an easy way to say "process this CMakeLists.txt as if it were in /other/path/source" (at least as far as file paths are concerned)?<br>
<br>
e.g.:<br>
<br>
add_library(my_lib<br>
src/a.c<br>
include/a.h<br>
)<br>
<br>
target_include_directories(my_lib PUBLIC include)<br>
<br>
I know I can add a full path prefix to every file, but there are a lot of them. I'm hoping for a shortcut.<br></blockquote><div><br></div><div>You can define a variable to define the base of the sources....</div><div>set( SOURCE_ROOT /some/path )</div><div><br></div><div>could be set relative to the current cmake path per cmake that uses those souces... and then just prefix it</div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div>
<span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">add_library(my_lib</span><br style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> ${SOURCE_ROOT}/src/a.c</span><br style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">
<span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">${SOURCE_ROOT}/</span>include/a.h</span><br style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">)</span>
<br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
--<br>
Andrew<br>
<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></div>