<div dir="ltr">Thanks for the reply. In my case, I didn't even want the CMakeLists in the top-level dir. I didn't want to contaminate my top-level dir with anything related to CMake. This would avoid, for example, an accidental overwrite of an existing Makefile if one was to do a 'cmake .' in the the top dir.<div><br></div><div>It's quite possible I'm over-thinking this; I was just curious if it's even possible. Seems like it should be. </div><div><br></div><div>-Randy</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 4, 2017 at 4:30 PM, J. Caleb Wherry <span dir="ltr"><<a href="mailto:calebwherry@gmail.com" target="_blank">calebwherry@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">There is no reason why this shouldn't work, I do something similar where everything except my top-level CMakeLists is shoved into a subdirectory (away from the src code location).<div><br></div><div>You don't have to muck with the project macro at all, not sure what you are trying to accomplish with that? That just sets the name of the project.</div><div><br></div><div>All you have to be aware of is all the paths are now with respect to both the CMakeLists and where ever you put your binary dir. So doing something like the below allows you to reference things in your source tree (depending on how far you away form the root, obviously):</div><div><br></div><div>get_filename_component(<wbr>SourceRoot "${CMAKE_CURRENT_SOURCE_DIR}/.<wbr>./../" ABSOLUTE)<br></div><div><br></div><div>The normal structure of the CMake file doesn't change, nothing special has to be done with the project macro. Unless you have a more specific error, that's about all the advice I have.</div><div><br></div><div>-Caleb</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Oct 4, 2017 at 3:16 PM, Randy Heiland <span dir="ltr"><<a href="mailto:randy.heiland@gmail.com" target="_blank">randy.heiland@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hello,<div><br></div><div>Simple question... can I/how can I keep my top-level cmake-related stuff in a subdirectory of my main project directory? E.g.:</div><div><br></div><div>/myproj</div><div>  /cmake</div><div>    CMakeLists.txt</div><div><br></div><div>and then in the /cmake, I create a /build from which I attempt:  cmake ..</div><div>







<p class="m_1715029472801525403m_1823411125408047178gmail-p1"><span class="m_1715029472801525403m_1823411125408047178gmail-s1">I tried something as simple as this in my </span>CMakeLists.txt, but it didn't seem to work:</p>project (../myproj)<br><br><br>The primary reason I'd like to do this is to hide/make optional the cmake build approach (and keep in place an existing/traditional Makefile in the parent directory). Play along...</div><div><br></div><div>thanks, Randy</div></div>
<br></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/CMak<wbr>e_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/su<wbr>pport.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/co<wbr>nsulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/tr<wbr>aining.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/opensou<wbr>rce/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/mail<wbr>man/listinfo/cmake</a><span class="HOEnZb"><font color="#888888"><br></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_1715029472801525403gmail_signature" data-smartmail="gmail_signature"><div>J. Caleb Wherry</div><i>Scientific Software Engineer</i><div><br><a href="http://www.calebwherry.com" target="_blank"></a><div><a href="http://www.calebwherry.com" target="_blank">http://www.calebwherry.com</a><br><span><span title="Call with Google Voice"><span title="Call with Google Voice"><a href="tel:(615)%20708-5651" value="+16157085651" target="_blank">+1 (615) 708-5651</a></span></span></span><div><a href="mailto:calebwherry@gmail.com" target="_blank">calebwherry@gmail.com</a></div></div></div></div>
</font></span></div>
</blockquote></div><br></div>