<div dir="ltr">Hi, Daniel, I&#39;ve tried this, but it doesn&#39;t work, it returns same error as before. And there are 2 lines in CMakeCache.txt:<br>//No help, variable specified on the command line. <br>A:BOOL=ON <br><br>
Best Regards,<br>ashi<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 2, 2013 at 7:44 PM, Daniel Pfeifer <span dir="ltr">&lt;<a href="mailto:daniel@pfeifer-mail.de" target="_blank">daniel@pfeifer-mail.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span style="font-family:arial,sans-serif"><a href="http://cmake.org/cmake/help/v2.8.10/cmake.html#opt:-Dvar:typevalue" target="_blank">http://cmake.org/cmake/help/v2.8.10/cmake.html#opt:-Dvar:typevalue</a></span><br>
</div>
<span style="font-family:arial,sans-serif;font-size:13px"><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">What is missing in the documentation, is that no cache entry is created if the type is not given.</span></div>

<div><span style="font-family:arial,sans-serif;font-size:13px">Set A as a cache entry of type BOOL like this:</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></span><div class="gmail_extra">

$ cmake -DCMAKE_TOOLCHAIN_FILE=./config.cmake -DA:BOOL=ON .</div><div class="gmail_extra"><br><div class="gmail_quote">2013/4/2 Ashi <span dir="ltr">&lt;<a href="mailto:ashi08104@gmail.com" target="_blank">ashi08104@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">I think I find something to explain this: the config.cmake(the CMAKE_TOOLCHAIN_FILE) is reloaded several times. on first-load, the A is set, but on second-load and later-load, the A is not set. I think I can get around this problem when A is kept set. However, I don&#39;t know how can I keep the value set in cmake. Could anyone give me some suggestion? Thanks! <br>


<div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Mon, Apr 1, 2013 at 7:47 PM, Ashi <span dir="ltr">&lt;<a href="mailto:ashi08104@gmail.com" target="_blank">ashi08104@gmail.com</a>&gt;</span> wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div>Hi all, I&#39;ve a problem in using else() in CMAKE_TOOLCHAIN_FILE, all files are:<br><br>#==CMakeLists.txt==<br>message(&quot;TEST&quot;)<br><br>#==config.cmake==<br>if(A)<br>        message(&quot;A&quot;)<br>



elseif(B)<br>        message(&quot;B&quot;)<br>elseif(C)<br>        message(&quot;C&quot;)<br>else()<br>        message(FATAL_ERROR &quot;NONE&quot;)<br>endif()<br><br>and I run the cmake:<br>$ cmake -DCMAKE_TOOLCHAIN_FILE=./config.cmake -DA=true .<br>



<br>cmake returns:<br><br>A<br>A<br>-- The C compiler identification is GNU 4.7.2<br>-- The CXX compiler identification is GNU 4.7.2<br></div>-- Check for working C compiler: /I usr/bin/gcc<div><br>CMake Error at /home/zhongwei/projects/cmake_test/config.cmake:8 (message):<br>



  NONE<br>Call Stack (most recent call first):<br>  /home/zhongwei/projects/cmake_test/build/CMakeFiles/CMakeSystem.cmake:1 (INCLUDE)<br>  CMakeLists.txt:2 (PROJECT)<br><br><br>CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage<br>



CMake Error: Internal CMake error, TryCompile configure of cmake failed<br>-- Configuring incomplete, errors occurred!<br><br>My problem is why the else() statement is still run when A=true?<br><br>Thanks,<br>ashi<br></div>

</div>

</blockquote></div><br></div></div>
<br></div></div><span class="HOEnZb"><font color="#888888">--<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></font></span></blockquote></div><br></div></div>
</blockquote></div><br></div>