-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
53 lines (39 loc) · 1.41 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
cmake_minimum_required (VERSION 2.8.1)
cmake_policy(SET CMP0042 NEW)
set(PROJECT_NAME "HitboxBuilder")
project (${PROJECT_NAME} CXX)
# Global variables
set(MODULE_DIR cmake)
set(SOURCE_DIR src)
set(INCLUDE_DIR include)
set(LIB_DIR lib)
set(IMPLEMENTATION_DIR detail)
set(TESTBED_DIR TestBed)
set(TESTER_NAME "${PROJECT_NAME}-tester")
set(CLANG_TIDY_CONFIG_SOURCE "${PROJECT_SOURCE_DIR}/.clang-tidy")
# CMake properties
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
set(PREDEFINED_TARGETS_FOLDER "CMake")
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/${MODULE_DIR})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_TYPE ${BUILD_TYPE})
message(STATUS "Building ${BUILD_TYPE} ${PROJECT_NAME}\n----------------------------")
# Resolve internal dependency
include(ResolveSFML)
# Set compiler flags
include(CompilerFlags)
# Source files.
include(Sources)
include_directories (${PROJECT_SOURCE_DIR})
include_directories (${PROJECT_SOURCE_DIR}/${INCLUDE_DIR})
add_library(${PROJECT_NAME} STATIC ${LIB_SOURCE_FILES})
if(HITBOX_BUILDER_ENABLE_CLANGTIDY AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
include(EnableClangTidy)
enable_clangtidy(SOURCES "${LIB_SOURCE_FILES}")
endif()
if(HITBOX_BUILDER_BUILD_TESTBED)
include(EnableTests)
endif()
install(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_DIR})
install(FILES ${LIB_EXPOSED_HEADER_FILES} DESTINATION "${INCLUDE_DIR}/${PROJECT_NAME}")