forked from geoffder/clipper2c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
66 lines (45 loc) · 1.6 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
cmake_minimum_required(VERSION 3.18)
project(clipper2c LANGUAGES CXX C)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# turn off unused parts of Clipper2
set(CLIPPER2_TESTS OFF)
set(CLIPPER2_EXAMPLES OFF)
set(CLIPPER2_UTILS OFF)
option(BUILD_SHARED_LIBS ON)
add_compile_options(-fPIC)
# set #define GO_BINDINGS if we are building for Go
if(GO_BINDINGS)
add_compile_definitions(GO_BINDINGS)
endif()
add_subdirectory(vendor/Clipper2/CPP)
file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
file(GLOB_RECURSE INCLUDE_FILES include/*.h)
set(PCFILE "${CMAKE_CURRENT_BINARY_DIR}/clipper2c.pc")
add_library(clipper2c SHARED ${INCLUDE_FILES} ${SOURCE_FILES})
# add executable if CLIPPER2_EXAMPLES is ON
if(CLIPPER2_EXAMPLES)
add_executable(offset examples/offset.c)
# link offset.c
target_link_libraries(
offset
PRIVATE clipper2c Clipper2
)
target_include_directories(offset PUBLIC clipper2c/include)
endif()
target_link_libraries(
clipper2c
PRIVATE Clipper2
)
target_include_directories(clipper2c PUBLIC clipper2c/include)
set_target_properties(clipper2c PROPERTIES FOLDER Libraries
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
PUBLIC_HEADER "${INCLUDE_FILES}"
)
CONFIGURE_FILE(clipper2c.pc.cmakein "${PCFILE}" @ONLY)
install(TARGETS clipper2c
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/clipper2c
)
install(FILES ${PCFILE} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
target_compile_features(clipper2c PUBLIC cxx_std_17)