You should put this variable into cache one way or another. (e.g. explicitly set with CACHE option or use in some find_* command).<div><br></div><div>The most straight-forward approach is to add to your <span class="" style>CMakeLists</span>.<span class="" style>txt</span> something like:</div>
<div>set(<span class="" style="font-family:arial,sans-serif;font-size:13px">CODE_BUILD_DIR "${</span><span class="" style="font-family:arial,sans-serif;font-size:13px">CODE_BUILD_DIR</span><span class="" style="font-family:arial,sans-serif;font-size:13px">}" CACHE PATH "Path to CODE package")</span></div>
<div><span class="" style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span class="" style="font-family:arial,sans-serif;font-size:13px">But beware that behavior depends on whether you specify this flag in successive <span class="" style>CMake</span> invocations.</span></div>
<div><div class="gmail_extra"><br></div><div class="gmail_extra">If you build nested project by yourself I suggest using find_package in <span class="" style>config</span> mode. Once <span class="" style>config</span> file found, <span class="" style>CMake</span> puts appropriate directory into cache and on successive runs reads package <span class="" style>config</span> file immediately. If that project is also build with <span class="" style>CMake</span> I suggest looking at exporting targets and registering exports locally.<br>
<br><div class="gmail_quote">On Fri, Nov 30, 2012 at 12:44 AM, <span class="" style>katie</span> <span class="" style>outram</span> <span dir="ltr"><<a href="mailto:katie.outram@gmail.com" target="_blank"><span class="" style>katie</span>.<span class="" style>outram</span>@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>I am trying to automate my build process and before going down this path, I set up findMYCODE script that requires a variable CODE_BUILD_DIR that the user defines. This variable is the build directory for another code base that my current code base is dependent on. When I run CMAKE in the gui, and define the variable, the find script locates the necessary path/items and this value is populated in the CMakeCache file. In the CMakeCache file my variable is listed as </div>
<div> </div><div>CODE_BUILD_DIR:PATH=C:/builddir/Win64/VC10/bin/Release</div><div> </div><div>However ,when I go to the command line and try to pass the needed build parameter via the command line, my value is not getting picked up and so my solution does not get generated. In order to get my solution I must have this variable defined.</div>
<div> </div><div>From the build directory where I am trying to complete the build I execute the following command:</div><div> </div><div>cmake -G "Visual Studio 10 Win64" -DCODE_BUILD_DIR:PATH=C:/builddir/Win64/VC10/bin/Release c:\mysource</div>
<div> </div><div>The variable CODE_BUILD_DIR int he above line is the first build directory for another code base that my current code is dependent on.</div><div> </div><div>I have tried several variations of this command line option and passing the -D variable, with and without escaping my path, however I am not having any success. Without this parameter defined,<em> </em>I am unable to locate the necessary libraries that I must use to link into my current code.</div>
<div> </div><div>I am thinking that I am possibly missing something in my find script, or maybe I'm not escaping the characters in my path correctly. </div><div> </div><div>Does anyone have any suggestions?</div><div>
</div><div>Thanks</div><div> </div><div> </div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div></div>