generated from tlemane/cpp-app-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
72 lines (52 loc) · 1.94 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
cmake_minimum_required(VERSION 3.13.0)
project(fimpera VERSION 0.0.1 LANGUAGES C CXX) #TODO
set(PROJECT_DESCRIPTION "") #TODO
set(LIBRARY_NAME "fimpera-lib")
option(STATIC_BUILD "Static build." OFF)
option(DEV_BUILD "Dev build." OFF)
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(WITH_TESTS "Compile tests." ON)
option(WITH_DOC "" ON)
option(WITH_CPPCHECK "" ON)
option(WITH_CLANGFORMAT "" ON)
option(WITH_PROFILE "" ON)
option(WITH_COVERAGE "" ON)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(include_all)
if (WITH_CPPCHECK)
enable_cppcheck()
endif()
if (STATIC_BUILD AND NOT APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_EXE_LINKER_FLAGS "-static")
endif()
if (DEV_MODE)
add_definitions(-D${CPP_APP_DEV_MODE}) #TODO
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -O0 -g -DNDEBUG")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAG} -O2 -g -DNDEBUG")
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS} -O0 -g --coverage -fno-inline -fno-inline-small-functions -fno-default-inline")# -fkeep-inline-functions")
include_directories(SYSTEM /usr/include)
include_directories(SYSTEM thirdparty/robinHoodHashing/src/include) # TODO move ?
include_directories(SYSTEM thirdparty/argparse/include) # TODO move ?
add_subdirectory(thirdparty)
get_sha1(${PROJECT_SOURCE_DIR} GIT_SHA1)
configure_file_helper("${PROJECT_SOURCE_DIR}/lib/include/config.hpp.in" ${PROJECT_BINARY_DIR}/include/fimpera-lib)
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
message(STATUS "dir2='${dir}'")
endforeach()
add_subdirectory(lib)
add_subdirectory(app)
if (WITH_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
if (WITH_DOC)
add_doxygen_target()
endif()
include(CPackConfig)