AW: AW: [CMake] Overriding default values

James Bigler bigler at cs.utah.edu
Fri Sep 2 15:11:34 EDT 2005


Thanks all.  The approach of setting my own FIRST_CONFIGURE variable did the 
trick.  It also works for CMake 1.8.

James

Brad King wrote:
> 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