[CMake] How to set platform-specific compiler-options from within CMakeFiles

Bill Hoffman bill.hoffman at kitware.com
Thu Jul 3 09:10:48 EDT 2008


Philip Lowman wrote:

> Wow this is an old thread.  Sorry for the late response.
> 
> I think what's needed here is a way to detect the platform and allow 
> people to modify CMAKE_CXX_FLAGS and friends before they get cemented in 
> stone in the cache.  IIRC doesn't CMAKE_USER_MAKE_RULES_OVERRIDE put the 
> onus on the user to know the proper platform, compiler, etc. before they 
> set the flags?
> 

No, CMAKE_USER_MAKE_RULES_OVERRIDE is included after CMAKE_SYSTEM_NAME 
and the compiler are set.  The _INIT variables will have been set, but 
the cache values have not yet been set.  This allows you to set them.

-Bill


More information about the CMake mailing list