1- #
2- # Small module used in every project to set up the default "compilation
3- # environment".
4- #
5- 61# Guard this file against multiple inclusions.
7- get_property ( _compilersSet GLOBAL PROPERTY COMPILER_SETTINGS_DONE SET )
8- if ( _compilersSet )
9- unset ( _compilersSet )
2+ get_property ( _common GLOBAL PROPERTY COMMON_DONE SET )
3+ if ( _common )
4+ unset ( _common )
105 return ()
116endif ()
12- set_property ( GLOBAL PROPERTY COMPILER_SETTINGS_DONE TRUE )
13- 7+ set_property ( GLOBAL PROPERTY COMMON_DONE TRUE )
148
15- # Set up a Debug build type by default, if the user didn't ask for something
16- # else.
9+ # Set up a Debug build type by default, if none was specified
1710if ( NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES )
1811 set ( CMAKE_BUILD_TYPE "Debug" CACHE
1912 STRING "Choose the type of build." FORCE )
@@ -23,6 +16,7 @@ endif()
2316
2417# Use C++17 in the project by default, or as high of a value as possible.
2518set ( CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to use" )
19+ set ( CMAKE_CXX_STANDARD_REQUIRED ON )
2620set ( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "(Dis)Allow C++ extensions" )
2721
2822# Enable (almost) all warnings for the build.
@@ -32,3 +26,8 @@ if( ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" ) OR
3226elseif ( "${CMAKE_CXX_COMPILER_ID} " STREQUAL "MSVC" )
3327 set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4" )
3428endif ()
29+ 30+ # Trivial module to set up the "solution" target for all projects.
31+ if ( NOT TARGET solution )
32+ add_custom_target ( solution )
33+ endif ()
0 commit comments