[CMake] Forwarding parameters to cmake through cmake-gui

J Decker d3ck0r at gmail.com
Fri Nov 1 21:51:13 EDT 2013


sorry and I should ask; after reading a bit more context;

why are you using cmake-gui if you have -D's to pass already?

but the macro does allow you to export them to the environment
instead; it doesn't update what was configured though; and actually
most places I use the same macro but without the CACHE STRING option
on the SET().


On Fri, Nov 1, 2013 at 6:41 PM, J Decker <d3ck0r at gmail.com> wrote:
>  I have a macro ..... (maybe it has a horrible name...)
>
> macro( DEFINE_DEFAULT variable default )
>     if( NOT DEFINED ${variable} )
>       #message( "variable ${variable} not defined (command line)" )
>       set( ${variable} $ENV{${variable}}  CACHE STRING "no description
> available")
>       if( "${${variable}}" STREQUAL "" )
>        set( ${variable} ${default} CACHE STRING "no description available")
>      endif( "${${variable}}" STREQUAL "" )
>    endif( NOT DEFINED ${variable} )
> endmacro( DEFINE_DEFAULT variable )
>
>
> usage:
>    DEFINE_DEFAULT( SOME_OPTION "c:/path/to/something" )
>
> then you can...
>
> set SOME_OPTION=c:/real/path/to/thing  cmake <source path>
>
> -or-
>
> cmake -DSOME_OPTION=C:/other/path/to/thing <source path>
>
> -or-
>
> cmake-gui <source path>
> (click configure)
> set the option appropriately.
>
>
> On Fri, Nov 1, 2013 at 7:47 AM, physhh . <physhh at gmail.com> wrote:
>> I've already searched for a feature like this but was not able to find it.
>> Then i've looked up in the cmake-gui source code but couldn't find anything
>> related.
>>
>> What I'm looking for:
>> If cmake is used directly from the command line, it's possible to pass a
>> bunch of options
>> (http://www.cmake.org/cmake/help/v2.8.12/cmake.html#section_Options). This
>> is nice because with this it's possible to use default settings - even if
>> the cache get deleted. I'm actually really interested in this because it
>> would be possible to set the CMAKE_MODULE_PATH variable via batch file -
>> which is neat for custom find modules in custom locations.
>>
>> My Request:
>> I would like to see a feature which makes it possible to pass command line
>> options to cmake-gui which get forwarded to cmake when it gets called. To
>> make this work the cmake-gui could look for parameters which look like
>> "forward-*" (where the * is a cmake option name) and pass it to cmake.
>>
>> Are there any counter-arguments against this?
>> In my opinion it would make things much cleaner.
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list