blob: f3c061d9fb25f91c4f17036371ae56fe81706988 (
plain)
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
|
cmake_minimum_required(VERSION 3.10)
# Project and C standard configuration
project(bhlib LANGUAGES C)
set(CMAKE_C_STANDARD 90)
set(CMAKE_C_STANDARD_REQUIRED ON)
# Check for IPO/LTO
include(CheckIPOSupported)
check_ipo_supported(RESULT supported)
if(supported)
message(STATUS "IPO/LTO enabled")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
# Enable testing
include(CTest)
enable_testing()
# Set library code
set(BHLIB_SOURCE
src/algo.c
src/hashmap.c
src/queue.c
)
set(BHLIB_HEADER
include/bh/algo.h
include/bh/hashmap.h
include/bh/queue.h
)
# Library
add_library(bhlib STATIC ${BHLIB_SOURCE} ${BHLIB_HEADER})
target_include_directories(bhlib PUBLIC include)
# Runtime definition
add_executable(main
main.c
)
target_link_libraries(main bhlib)
# Tests
add_subdirectory(unit)
add_subdirectory(tests)
|