forked from rickbrew/GeneralPolygonClipper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
38 lines (29 loc) · 1.3 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
### Setup cmake requirement ###
cmake_minimum_required(VERSION 3.10...3.25)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
### Setup project information ###
project(GPCWrapper
VERSION 1.0.0
DESCRIPTION "C++ Wrapper for Generic Polygon Clipper"
LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 11)
### Require out-of-source builds ###
file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH)
if(EXISTS "${LOC_PATH}")
message(FATAL_ERROR "You cannot build in a source directory (or any directory with a CMakeLists.txt file). Please make a build subdirectory. Feel free to remove CMakeCache.txt and CMakeFiles.")
endif()
### Compile source code ###
add_library(gpc STATIC "gpc.c" "gpc.h")
target_include_directories(gpc PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
add_library(fcpc STATIC "fcpc.cc" "fcpc.h")
target_include_directories(fcpc PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
### Compile wrapper code ###
add_library(gpcpp STATIC "gpcpp.cc" "gpcpp.h")
target_include_directories(gpcpp PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
target_link_libraries(gpcpp PRIVATE gpc)
### Compile test code ###
add_executable(test_gpc "test.cc")
target_include_directories(test_gpc PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
target_link_libraries(test_gpc PRIVATE gpcpp fcpc)