[CMake] Change variable default

Tim Gallagher tim.gallagher at gatech.edu
Thu Apr 28 11:23:01 EDT 2011


We do this:

if(NOT CMAKE_Fortran_FLAGS_RELEASE)
   set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -xhost" CACHE STRING "" FORCE)
endif()

In other words, if the flags haven't been set yet (initial start up), set them to what we want. If they have been set (either changed by the user, or specified on the cmake/ccmake line with -D), leave them alone.

Tim

----- Original Message -----
From: "Ilja Golshtein" <ilejncs at narod.ru>
To: cmake at cmake.org
Sent: Thursday, April 28, 2011 9:03:43 AM
Subject: [CMake] Change variable default

Hello!

There are some CMAKE variables with default values. For example CMAKE_CXX_FLAGS_DEBUG default value is '-g'. 
How is it possible to make it '-g -Wall'?

What I don't want to have: User choice overwritten.

What I want to have: Modified a variable cmake-time default. It must be possible to change the variable via cmake -D or ccmake GUI.

Thanks.

-- 
Best regards,
Ilja Golshtein.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list