<div dir="ltr"><div><div>It looks as if CMake was interpreting the path as both the source directory and the initial cache file. Perhaps you could help it by adding the path to source explicitly:<br><br></div>cmake -C ../config.cmake whatever/your/path/to/source/is<br><br></div><div>Petr</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 21, 2016 at 4:10 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><br></div><div><br>Hi Petr,<br></div><div><br></div><div>thank you very much for your answer!<br></div><div><br></div><div>Indeed, comment string arguments seem to be mandatory.<br></div><div>I modified my configuration file like this:<br></div><div><br></div><div>set(ENABLE_DOWNLOAD True CACHE BOOL "Automatic installation of third-party libraries")<br>set(GCC_ROOT "/local/cdoucet/gcc/4.9.2/" CACHE PATH "Root of GCC")<br></div><div><br></div><div>Now, I get the following error message:<br></div><div><br></div><div>CMake Error: The source directory "/local/cdoucet/simol/config.cmake" is a file, not a directory.<br></div><div><br></div><div>I am quite surprised about this message because I thought a file was required to the command 'cmake -C'.<br></div><div><br></div><div>Do you have any idea of what I am doing wrong here?<br></div><div><br></div><div>----- Petr Kmoch <<a href="mailto:petr.kmoch@gmail.com" target="_blank">petr.kmoch@gmail.com</a>> a écrit :<br>></div><div dir="ltr"><div><div>Hi Cedric.<br><div><br></div></div>I believe the comment string argument is mandatory in a set(... CACHE), so it should be something like this:<br><div><br></div>set(ENABLE_DOWNLOAD True CACHE BOOL "Should download be enabled")<br>set(GCC_ROOT "/local/cdoucet/gcc/4.9.2/" CACHE PATH "Path to root directory of GCC installation")<br><div><br></div></div>Petr<br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 21, 2016 at 3:43 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><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><div><br></div></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><div><br></div><br>CMake Error at /local/cdoucet/simol/config.cmake:2 (set):<br>  set given invalid arguments for CACHE mode.<br><div><br></div><br>CMake Error: The source directory "/local/cdoucet/simol/config.cmake" is a file, not a directory.<br><div><br></div></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><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><div><br></div><div><br></div></div></blockquote></div><br></div>