-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
43 lines (35 loc) · 1.02 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
cmake_minimum_required(VERSION 3.17)
project(owlstd)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_COLOR_DIAGNOSTICS ON)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
option(BUILD_EXAMPLES "Build examples targets" OFF)
option(BUILD_TESTS "Build testing target" OFF)
option(ENABLE_CCACHE "Use ccache for compilation" ON)
add_library(${PROJECT_NAME} STATIC)
target_sources(${PROJECT_NAME} PRIVATE
src/str.c
src/str_hashmap.c
src/vector.c
)
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
if (BUILD_TESTS)
add_subdirectory(tests)
endif(BUILD_TESTS)
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif(BUILD_EXAMPLES)
if (ENABLE_CCACHE)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_COMPILER_LAUNCHER ccache)
message(STATUS "ccache found and enabled")
else()
message(NOTICE "ccache not found")
endif()
endif(ENABLE_CCACHE)