AW: AW: [CMake] Overriding default values

Brad King brad.king at kitware.com
Fri Sep 2 15:08:02 EDT 2005


James Bigler wrote:
> Well, this works if you want to make sure a particular flag is always 
> present. It doesn't allow the user to remove it and keep it gone.  I 
> think for that I still need to know of way to see if this is the first 
> configure or not.

IF(NOT MYPROJ_CONFIGURED)
   # Change default values.
   ... fix CMAKE_CXX_FLAGS however you want ...

   # Save fixed default value in cache.
   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING
       "Flags passed to C++ compiler." FORCE)

   # We have fixed defaults on the first configure.
   # Set the blocker to avoid fixing values again.
   SET(MYPROJ_CONFIGURED 1 CACHE INTERNAL
       "Myproj configured at least once.")
ENDIF(NOT MYPROJ_CONFIGURED)

-Brad


More information about the CMake mailing list