<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">From: Gabriel Petrovay &lt;<a href="mailto:gabipetrovay@gmail.com">gabipetrovay@gmail.com</a>&gt;<br>

Subject: [CMake] CMake command line arguments<br><br>
Hi,<br>
<br>
Is there a way to read the arguments that were passed to CMake from<br>
inside a CMakeLists.txt file?<br>
<br>
There is a problem that some generators (like &quot;NMake Makefiles&quot;) set a<br>
default value for certain variables (like CMAKE_BUILD_TYPE=Debug,<br>
CMAKE_INSTALL_PREFIX=C:\Program Files\${CMAKE_PROJECT_NAME})<br>
<br>
&gt;From inside CMake one can not set up a different default value if the<br>
user does not specify it with a -D option. This is because<br>
IF(CMAKE_BUILD_TYPE) will always be true because of the default set by<br>
the generator (&quot;NMake Makefiles&quot;).<br>
<br>
There was this guy having the same problem:<br>
<a href="http://www.mail-archive.com/cmake@cmake.org/msg09640.html" target="_blank">http://www.mail-archive.com/cmake@cmake.org/msg09640.html</a><br>
<br>
Any solution how one can solve this? Reading the arguments passed to<br>
CMake would be one, but I find no documentation/example/google_result<br>
for this.<br>
<br>
<br>
Thanks!<br>
<br>
--<br>
MSc Gabriel Petrovay<br>
Mobile: +41(0)787978034<br>
<a href="http://www.28msec.com" target="_blank">www.28msec.com</a><br><br></blockquote><div><br></div><div>I use &quot;<span class="Apple-style-span" style="font-family: arial, 宋体, sans-serif; font-size: 14px; line-height: 24px; ">environment variables</span>&quot;<font class="Apple-style-span" face="arial, 宋体, sans-serif"><span class="Apple-style-span" style="font-size: 14px; line-height: 24px;"> to handle this problem. Such as “$ENV{</span></font><span class="Apple-style-span" style="font-family: arial, 宋体, sans-serif; font-size: 14px; line-height: 24px; "><span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 22px; ">PATH</span>}”.</span></div>
<div><span class="Apple-style-span" style="font-family: arial, 宋体, sans-serif; font-size: 14px; line-height: 24px; "><br></span></div></div>Liang Xu<br>