-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
68 lines (58 loc) · 1.75 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
cmake_minimum_required(VERSION 3.15)
project(Tetgen)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
set(CMAKE_INSTALL_RPATH "$ORIGIN")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
add_library(tetgen STATIC include/tetgen.h src/tetgen.cxx src/predicates.cxx)
set_target_properties(tetgen
PROPERTIES
POSITION_INDEPENDENT_CODE ON
)
target_compile_definitions(tetgen
PUBLIC
TETLIBRARY
)
include(GNUInstallDirs)
target_include_directories(tetgen
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
include(GenerateExportHeader)
include(CMakePackageConfigHelpers)
if(WIN32)
set(CMAKE_CONFIG_DESTINATION cmake)
else()
set(CMAKE_CONFIG_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
endif()
export(TARGETS tetgen
NAMESPACE ${PROJECT_NAME}::
FILE ${PROJECT_BINARY_DIR}/${CMAKE_CONFIG_DESTINATION}/tetgen_target.cmake
)
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(TARGETS tetgen
EXPORT tetgen
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(EXPORT tetgen
FILE tetgen_target.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_CONFIG_DESTINATION}
)
set(OUTPUT_CONFIG_FILE ${PROJECT_BINARY_DIR}/${CMAKE_CONFIG_DESTINATION}/${PROJECT_NAME}Config.cmake)
configure_package_config_file(
${PROJECT_NAME}Config.cmake.in
${OUTPUT_CONFIG_FILE}
INSTALL_DESTINATION ${CMAKE_CONFIG_DESTINATION}
)
install(
FILES ${OUTPUT_CONFIG_FILE}
DESTINATION ${CMAKE_CONFIG_DESTINATION}
)