| 1 |
# Set a default build type if none was specified |
| 2 |
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) |
| 3 |
message(STATUS "Setting build type to 'Release' as none was specified.") |
| 4 |
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) |
| 5 |
set_property( |
| 6 |
CACHE CMAKE_BUILD_TYPE |
| 7 |
PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" |
| 8 |
) |
| 9 |
endif() |
| 10 |
|
| 11 |
# Enable compiler warnings on gcc and clang (common compilers used by developers) |
| 12 |
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 13 |
set(CMAKE_CXX_FLAGS |
| 14 |
"${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas -Wno-deprecated-declarations" |
| 15 |
) |
| 16 |
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas") |
| 17 |
endif() |