<div dir="ltr"><div><div><div>Hi Saad.<br><br></div>I can't comment on whether the behaviour is correct or expectable, but to get it working the way you want, you can specify the path fully:<br><br></div>include(${CMAKE_CURRENT_LIST_DIR}/Bar.cmake)<br><br></div>Petr<br><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 13 December 2017 at 01:34, Saad Khattak <span dir="ltr"><<a href="mailto:saadrustam@gmail.com" target="_blank">saadrustam@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>Let's say I have the following directory structure:</div><div>~/Repos/MyRepo/CMakeLists.txt</div><div>~/CMakeFiles/Foo.cmake</div><div>~/CMakeFiles/Bar.cmake<br><div><br></div><div>In the CMakeLists.txt I have the following command:</div><div><br></div><div>include(~/CMakeFiles/Foo.<wbr>cmake)</div><div><br></div><div>And in Foo.cmake I have the following command:</div></div><div><br></div><div>include(Bar.cmake)</div><div><br></div><div>Turns out that he `include(Bar.cmake)` from `Foo.cmake` fails. This is counter to what I would expect (e.g. how #include works in C).</div><div><br></div><div>Is this a bug or is this behavior expected? If it's expected, what is the workaround? We have a lot of common cmake files which in turn include files relative to each other and not the calling CMakeLists.txt.</div><div><br></div><div>Thank you,</div><div>Saad</div></div>
<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/<wbr>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/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>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/<wbr>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/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a><br></blockquote></div><br></div></div>