1
1
cmake_minimum_required (VERSION 3.5)
2
2
project (laser_segmentation)
3
3
4
+ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES )
5
+ message (STATUS "Setting build type to Release as none was specified." )
6
+ set (CMAKE_BUILD_TYPE "Release" CACHE
7
+ STRING "Choose the type of build." FORCE)
8
+
9
+ # Set the possible values of build type for cmake-gui
10
+ set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
11
+ "Debug" "Release" "MinSizeRel" "RelWithDebInfo" )
12
+ endif ()
13
+
4
14
# Default to C++17
5
15
if (NOT CMAKE_CXX_STANDARD)
6
16
if ("cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
@@ -15,6 +25,25 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
15
25
add_compile_options ("$<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor>" )
16
26
endif ()
17
27
28
+ option (COVERAGE_ENABLED "Enable code coverage" FALSE )
29
+ if (COVERAGE_ENABLED)
30
+ add_compile_options (--coverage)
31
+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage" )
32
+ set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" )
33
+ endif ()
34
+
35
+ # Defaults for Microsoft C++ compiler
36
+ if (MSVC )
37
+ # https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/
38
+ set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON )
39
+
40
+ # Enable Math Constants
41
+ # https://docs.microsoft.com/en-us/cpp/c-runtime-library/math-constants?view=vs-2019
42
+ add_compile_definitions (
43
+ _USE_MATH_DEFINES
44
+ )
45
+ endif ()
46
+
18
47
# ###############################################
19
48
# # Find dependencies ##
20
49
# ###############################################
0 commit comments