[CMake] CMake command line arguments

徐亮 lxu4net at gmail.com
Sun Mar 6 20:41:56 EST 2011


>
> From: Gabriel Petrovay <gabipetrovay at gmail.com>
> Subject: [CMake] CMake command line arguments
>
> Hi,
>
> Is there a way to read the arguments that were passed to CMake from
> inside a CMakeLists.txt file?
>
> There is a problem that some generators (like "NMake Makefiles") set a
> default value for certain variables (like CMAKE_BUILD_TYPE=Debug,
> CMAKE_INSTALL_PREFIX=C:\Program Files\${CMAKE_PROJECT_NAME})
>
> >From inside CMake one can not set up a different default value if the
> user does not specify it with a -D option. This is because
> IF(CMAKE_BUILD_TYPE) will always be true because of the default set by
> the generator ("NMake Makefiles").
>
> There was this guy having the same problem:
> http://www.mail-archive.com/cmake@cmake.org/msg09640.html
>
> Any solution how one can solve this? Reading the arguments passed to
> CMake would be one, but I find no documentation/example/google_result
> for this.
>
>
> Thanks!
>
> --
> MSc Gabriel Petrovay
> Mobile: +41(0)787978034
> www.28msec.com
>
>
I use "environment variables" to handle this problem. Such as “$ENV{PATH}”.

Liang Xu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110307/40d5677a/attachment-0001.htm>


More information about the CMake mailing list