CMake loads option defaults from the platform file and then usually proceeds to write these to the cache, so it is not possible to see if an option was specified by the user, or was the default. By setting CMAKE_NOT_USING_CONFIG_FLAGS, we regain control over the options and can then set this to what we think is suitable, provided that the user hasn't specified something for us.
12 lines
372 B
CMake
12 lines
372 B
CMake
# - Turn on warnings when compiling
|
|
|
|
include (AddOptions)
|
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
|
# default warnings flags, if not set by user
|
|
set_default_option (_warn_flag "-Wall" "(^|\ )-W")
|
|
if (_warn_flag)
|
|
message (STATUS "All warnings enabled: ${_warn_flag}")
|
|
add_options (ALL_LANGUAGES ALL_BUILDS "${_warn_flag}")
|
|
endif (_warn_flag)
|
|
endif (CMAKE_COMPILER_IS_GNUCXX)
|