@@ -30,7 +30,7 @@ project(
3030)
3131
3232# 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/" )
3434
3535# Output the compilation database
3636set (CMAKE_EXPORT_COMPILE_COMMANDS
@@ -63,38 +63,13 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
6363 set (MASTER_PROJECT ON )
6464endif ()
6565
66- if (MSVC )
67- add_compile_options (/W4 )
68- else ()
69- add_compile_options (-Wall -Wextra -pedantic )
70- endif (MSVC )
71-
7266# If this option is set we are building using continous integration
7367option (CI_BUILD "Enable build options for building in the CI server" OFF )
7468
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 )
9873
9974# If we are doing a CI build then we want to enable -Werror when compiling warnings are bad. We will also make it fail
10075# if clang-tidy has an error
@@ -106,19 +81,11 @@ if(CI_BUILD)
10681 endif ()
10782endif (CI_BUILD )
10883
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-
11784# Add the src directory
11885add_subdirectory (src )
11986
12087# 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 )
12289if (BUILD_TESTS)
12390 enable_testing ()
12491 add_subdirectory (tests )
0 commit comments