<div dir="ltr"><div>Hi Cedric,<br><br></div>The option can be a bit confusing.  The cache file you pass is actually a CMake script that sets cache variables, rather than the cache variables as seen in CMakeCache.txt.  So you would actually want your cache file to contain:<br><span style="font-family:monospace,monospace"><br></span><div><span style="font-family:monospace,monospace">set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build")<br></span></div><div><span style="font-family:monospace,monospace">set(CMAKE_INSTALL_PREFIX /home/me/</span><span style="font-family:monospace,monospace">there CACHE PATH "Install path prefix, prepended onto install directories.")<br></span></div><div><span style="font-family:monospace,monospace">set(CMAKE_CXX_COMPILER /usr/local/</span><span style="font-family:monospace,monospace">gcc/4.9.3/g++ CACHE FILEPATH "CXX Compiler")<br></span></div><br><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr">- Chuck<br></div></div></div>
<br><div class="gmail_quote">On Thu, Jan 21, 2016 at 9:43 AM, Cedric Doucet <span dir="ltr"><<a href="mailto:cedric.doucet@inria.fr" target="_blank">cedric.doucet@inria.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><br></div><div><br>Hello,</div><div><br></div><div>I do not manage to pass a configuration file to cmake.<br></div><div><br></div><div>I type 'cmake -C ../config.cmake'<br></div><div><br></div><div>where config.cmake belongs to the parent directory and contains these lines:<br></div><div><br></div><div>set(ENABLE_DOWNLOAD True CACHE BOOL)<br>set(GCC_ROOT "/local/cdoucet/gcc/4.9.2/" CACHE PATH)<br><br></div><div>I get the following error message but I don't understand why:<br></div><div><br></div><div>loading initial cache file ../config.cmake<br>CMake Error at /local/cdoucet/simol/config.cmake:1 (set):<br>  set given invalid arguments for CACHE mode.<br><br><br>CMake Error at /local/cdoucet/simol/config.cmake:2 (set):<br>  set given invalid arguments for CACHE mode.<br><br><br>CMake Error: The source directory "/local/cdoucet/simol/config.cmake" is a file, not a directory.<br><br></div><div><br></div><div>Do you know how to solve this problem?</div><div><br></div><div>----- Cedric Doucet <<a href="mailto:cedric.doucet@inria.fr" target="_blank">cedric.doucet@inria.fr</a>> a écrit :<br>></div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000"><div><br></div><div>Hi Peter!</div><div><br></div><div>Thank you very much!</div><div>It seems to be exactly what I want. :)</div><div>I will try to use it.</div><div><br></div><div>Cédric</div><div><br></div><hr><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>De: </b>"Petr Kmoch" <<a href="mailto:petr.kmoch@gmail.com" target="_blank">petr.kmoch@gmail.com</a>><br><b>À: </b>"Cedric Doucet" <<a href="mailto:cedric.doucet@inria.fr" target="_blank">cedric.doucet@inria.fr</a>><br><b>Cc: </b><a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a><br><b>Envoyé: </b>Lundi 21 Décembre 2015 13:25:53<br><b>Objet: </b>Re: [CMake] How to pass a configuration file to CMake?<br><div><br></div><div dir="ltr"><div><div>Hi Cedric.<br><div><br></div></div>I have never used it myself, but I believe you're looking for CMake's command-line option '-C <initial-cache>': <a href="https://cmake.org/cmake/help/latest/manual/cmake.1.html" target="_blank">https://cmake.org/cmake/help/latest/manual/cmake.1.html</a><br><div><br></div></div>Petr<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 21, 2015 at 1:12 PM, Cedric Doucet <span dir="ltr"><<a href="mailto:cedric.doucet@inria.fr" target="_blank">cedric.doucet@inria.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000"><div><br></div><div>Hello,</div><div><br></div><div>I would like to know if it's possible to pass a configuration file to CMake.</div><div>I have to pass a lot of information to CMake and the resulting command line is very long to type.</div><div>Would it be possible to create a file containing all needed definitions and pass it to CMake?</div><div><br></div><div>For exemple, instead of typing</div><div><br></div><div>cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=/home/me/there -D CMAKE_CXX_COMPILER=/usr/local/gcc/4.9.3/g++</div><div><br></div><div>would it be possible to create a file containing</div><div><br></div><div>CMAKE_BUILD_TYPE=Debug</div><div>CMAKE_INSTALL_PREFIX=/home/me/there</div><div>CMAKE_CXX_COMPILER=/usr/local/gcc/4.9.3/g++</div><div><br></div><div>and pass it to CMake?</div><div><br></div><div>Cédric</div></div></div><br>--<br><div><br></div>><br><div><br></div>> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br><div><br></div>><br><div><br></div>> 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><div><br></div>><br><div><br></div>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br><div><br></div>><br><div><br></div>> CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br><div><br></div>> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br><div><br></div>> 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><div><br></div>><br><div><br></div>> 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><div><br></div>><br><div><br></div>> Follow this link to subscribe/unsubscribe:<br><div><br></div>><a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div><br>></blockquote><br></div><div><br></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/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="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div></div>