-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
95 lines (72 loc) · 2.48 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
cmake_minimum_required(VERSION 3.6)
if( NOT WIN32 )
set( BLU "[1;34m" CACHE STRING "AnsiBlue" )
set( RED "[1;31m" CACHE STRING "AnsiRed" )
set( MAG "[1;35m" CACHE STRING "AnsiMagenta" )
set( CYN "[1;36m" CACHE STRING "AnsiCyan" )
set( YLW "[1;33m" CACHE STRING "AnsiYellow" )
set( WHT "[37m" CACHE STRING "AnsiWhite" )
set( BLK "[30m" CACHE STRING "AnsiBlack" )
set( RST "[0m" CACHE STRING "AnsiReset" )
function( colourized MESSAGE COL )
message( "${COL}${MESSAGE}${RST}" )
endfunction()
endif()
project( ruff CXX )
#project( ruff VERSION 0.0.1
# DESCRIPTION "Ruff"
# LANGAUGES CXX)
set(CMAKE_BUILD_TYPE "Release")
include(cmake/Conan.cmake)
run_conan()
colourized("CMAKE_PROJECT_NAME: ${CMAKE_PROJECT_NAME}" ${MAG} )
colourized("PROJECT_NAME: ${PROJECT_BINARY_DIR}" ${MAG} )
colourized("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}" ${MAG} )
colourized("PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}" ${MAG} )
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(BUILD_TESTERS "Build testers" ON)
option(BUILD_EXAMPLES "Build examples" ON)
include (cmake/Cache.cmake)
if( CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME )
# append path to search for cmake modules
set( CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} )
# support IDE folders
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
# turn off compiler specific extensions
set( CMAKE_CXX_EXTENSIONS OFF )
endif()
include( cmake/CppCheck.cmake )
include( cmake/ClangFormat.cmake )
#set(CMAKE_CXX_CLANG_TIDY "clang-tidy")
if(BUILD_TESTERS)
add_definitions(-DBUILD_TESTERS)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options (-fdiagnostics-color=always)
set(OPTS -Wall -Wextra -Wctor-dtor-privacy -Wno-init-list-lifetime
-Wnoexcept -Wstrict-null-sentinel -Wold-style-cast
-Weffc++ -Woverloaded-virtual -Wsign-promo)
endif()
colourized( "Compile Options: ${OPTS}" ${YLW} )
find_package( Doxygen )
if( Doxygen_FOUND )
colourized( "Configuring Docs" ${BLU} )
add_subdirectory( docs )
else()
message( STATUS "Doxygen not found, not building docs" )
endif()
# Add target Ruff
colourized( "Configuring Ruff Library" ${BLU} )
add_subdirectory(src)
if(BUILD_TESTERS)
colourized( "Configuring Testers Library" ${BLU} )
add_subdirectory(test)
endif()
if(BUILD_EXAMPLES)
colourized( "Configuring examples" ${BLU} )
add_subdirectory(examples)
endif()
configure_file(
${PROJECT_SOURCE_DIR}/cmake/${CMAKE_PROJECT_NAME}-config.hpp.in
${PROJECT_SOURCE_DIR}/src/${CMAKE_PROJECT_NAME}-config.hpp
)