-
Notifications
You must be signed in to change notification settings - Fork 111
/
CMakeLists.txt
60 lines (46 loc) · 1.56 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
cmake_minimum_required(VERSION 2.8)
project(libccd C)
set(CCD_VERSION "2.0")
set(CCD_SOVERSION "2")
set(PKG_DESC "Library for collision detection between convex shapes")
# Include GNUInstallDirs to get canonical paths
include(GNUInstallDirs)
include_directories("src/")
# make sure only DOUBLE or SINGLE is set; default to SINGLE
if (${CCD_SINGLE})
set(CCD_DOUBLE false)
else()
set(CCD_SINGLE true)
endif()
if (${CCD_DOUBLE})
set(CCD_SINGLE false)
endif()
# set the default build type
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/ccd/config.h.cmake.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/ccd/config.h")
if(NOT WIN32)
find_library(MATH m)
else()
set(MATH "")
endif()
set(SOURCE_FILES
src/ccd.c
src/mpr.c
src/polytope.c
src/support.c
src/vec3.c)
add_library(ccd SHARED ${SOURCE_FILES})
set_target_properties(ccd PROPERTIES VERSION ${CCD_VERSION} SOVERSION ${CCD_SOVERSION})
target_link_libraries(ccd ${MATH})
add_library(ccd_static STATIC ${SOURCE_FILES})
set_target_properties(ccd_static PROPERTIES OUTPUT_NAME ccd)
target_link_libraries(ccd_static ${MATH})
set(pkg_conf_file "${CMAKE_CURRENT_SOURCE_DIR}/ccd.pc")
configure_file("${pkg_conf_file}.in" "${pkg_conf_file}" @ONLY)
install(TARGETS ccd ccd_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY src/ccd DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h")
install(FILES "${pkg_conf_file}" DESTINATION
${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT pkgconfig)