-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
70 lines (47 loc) · 1.87 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
cmake_minimum_required(VERSION 3.20)
project(fjson)
file(GLOB PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
file(GLOB fjson_sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c)
add_executable(fjson_e ${fjson_sources})
list(FILTER fjson_sources EXCLUDE REGEX "main.c")
add_library(fjson SHARED ${fjson_sources})
add_library(fjson_static STATIC ${fjson_sources})
target_compile_options(fjson PUBLIC -fPIC)
target_compile_options(fjson_static PUBLIC -fPIC)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(
fjson
PUBLIC
$<INSTALL_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(
fjson_static
PUBLIC
$<INSTALL_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(
fjson_e
PUBLIC
$<INSTALL_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include)
include(FetchContent)
FetchContent_Declare(
hashmap_static
GIT_REPOSITORY /home/ianertson/workspace/hashmap
)
if (NOT TARGET hashmap_static)
FetchContent_MakeAvailable(hashmap_static)
endif()
target_link_libraries(fjson_e PUBLIC hashmap_static pthread m)
target_link_libraries(fjson PUBLIC hashmap_static pthread m)
target_link_libraries(fjson_static PUBLIC hashmap_static pthread m)
add_subdirectory(tests)