forked from serjzimmerman/lfuda-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
59 lines (46 loc) · 1.39 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
cmake_minimum_required(VERSION 3.11)
project(lfuda)
option(INSOURCEBUILD OFF)
if((${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR}) AND NOT ${INSOURCEBUILD})
message(FATAL_ERROR "In-source building disabled. Provide -DINSOURCEBUILD option if you are sure about it.")
endif()
# Possibly support windows and MSVC compiler
if(MSVC)
add_compile_options(/W3)
else()
add_compile_options(-Wall -Wextra)
endif()
# Common include directories and install directory
set(LFUDA_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)
set(LFUDA_BIN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bin)
find_package(GTest)
set(NOGTEST ON CACHE BOOL "Disable GoogleTest")
enable_testing()
if(NOT NOGTEST AND GTEST_FOUND AND CMAKE_MINOR_VERSION GREATER_EQUAL 20)
else()
message(WARNING "Google Test disabled")
endif()
set(NOLINT ON CACHE BOOL "Disable clang-tidy")
if(NOT ${NOLINT})
find_program(CLANG_TIDY_COMMAND clang-tidy)
if(CLANG_TIDY_COMMAND)
# Clang-tidy for linting
set(CMAKE_CXX_CLANG_TIDY
clang-tidy;
-checks=google-*,cppcoreguidelines-*
)
set(CMAKE_C_CLANG_TIDY
clang-tidy;
-checks=google-*,cppcoreguidelines-*
)
else()
message(WARNING "Unable to find clang-tidy, linter disabled")
endif()
else()
message(WARNING "-DNOLINT option provided, linter disabled")
endif()
set(DCMAKE_EXPORT_COMPILE_COMMANDS ON)
find_program(BASH_PROGRAM bash)
add_subdirectory(lfuda)
add_subdirectory(test)
add_subdirectory(util)