@@ -30,7 +30,7 @@ project(
30
30
)
31
31
32
32
# We use additional modules that cmake needs to know about
33
- set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR} /cmake/Modules/" )
33
+ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR} /cmake/" " ${CMAKE_SOURCE_DIR} /cmake/ Modules/" )
34
34
35
35
# Output the compilation database
36
36
set (CMAKE_EXPORT_COMPILE_COMMANDS
@@ -63,38 +63,13 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
63
63
set (MASTER_PROJECT ON )
64
64
endif ()
65
65
66
- if (MSVC )
67
- add_compile_options (/W4 )
68
- else ()
69
- add_compile_options (-Wall -Wextra -pedantic )
70
- endif (MSVC )
71
-
72
66
# If this option is set we are building using continous integration
73
67
option (CI_BUILD "Enable build options for building in the CI server" OFF )
74
68
75
- # Default not to run the clang-tidy checks, default to whatever our CI_BUILD is
76
- option (ENABLE_CLANG_TIDY "Enable building with clang-tidy checks." )
77
- if (ENABLE_CLANG_TIDY )
78
- # Search for clang-tidy first as this is the version installed in CI
79
- find_program (CLANG_TIDY_EXECUTABLE NAMES clang-tidy )
80
- message (STATUS "Found clang-tidy: ${CLANG_TIDY_EXECUTABLE} " )
81
- if (NOT CLANG_TIDY_EXECUTABLE )
82
- message (FATAL_ERROR "clang-tidy not found." )
83
- endif ()
84
-
85
- # Report clang-tidy executable details
86
- execute_process (COMMAND "${CLANG_TIDY_EXECUTABLE} " "--version" OUTPUT_VARIABLE CLANG_TIDY_VERSION )
87
- string (REGEX REPLACE ".*LLVM version ([0-9.]*).*" "\\ 1" CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION} " )
88
- message (STATUS "Found clang-tidy: ${CLANG_TIDY_EXECUTABLE} ${CLANG_TIDY_VERSION} " )
89
-
90
- # Build clang-tidy command line
91
- set (CLANG_TIDY_ARGS "${CLANG_TIDY_EXECUTABLE} " "--use-color" "--config-file=${PROJECT_SOURCE_DIR} /.clang-tidy" )
92
- if (CI_BUILD )
93
- set (CLANG_TIDY_ARGS "${CLANG_TIDY_EXECUTABLE} " "-warnings-as-errors=*" )
94
- endif (CI_BUILD )
95
- set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_ARGS} " "--extra-arg=-std=c++14" )
96
- set (CMAKE_C_CLANG_TIDY "${CLANG_TIDY_ARGS} " "--extra-arg=-std=c99" )
97
- endif (ENABLE_CLANG_TIDY )
69
+ # Include files to set up the compiler options
70
+ include (ClangTidy )
71
+ include (CompilerOptions )
72
+ include (Sanitizers )
98
73
99
74
# If we are doing a CI build then we want to enable -Werror when compiling warnings are bad. We will also make it fail
100
75
# if clang-tidy has an error
@@ -106,19 +81,11 @@ if(CI_BUILD)
106
81
endif ()
107
82
endif (CI_BUILD )
108
83
109
- # Make the compiler display colours always (even when we build with ninja)
110
- if (CMAKE_CXX_COMPILER_ID MATCHES GNU )
111
- add_compile_options (-fdiagnostics-color=always )
112
- endif ()
113
- if (CMAKE_CXX_COMPILER_ID MATCHES Clang )
114
- add_compile_options (-fcolor-diagnostics )
115
- endif ()
116
-
117
84
# Add the src directory
118
85
add_subdirectory (src )
119
86
120
87
# Add the tests directory
121
- option (BUILD_TESTS "Builds all of the NUClear unit tests." TRUE )
88
+ option (BUILD_TESTS "Builds all of the NUClear unit tests." OFF )
122
89
if (BUILD_TESTS )
123
90
enable_testing ()
124
91
add_subdirectory (tests )
0 commit comments