-
Notifications
You must be signed in to change notification settings - Fork 111
/
CMakeLists.txt
88 lines (78 loc) · 2.13 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
if(DEFINED CCD_SINGLE OR DEFINED CCD_DOUBLE)
# make sure only DOUBLE or SINGLE is set; default to SINGLE
if(CCD_SINGLE)
set(CCD_DOUBLE OFF)
else()
set(CCD_SINGLE ON)
endif()
if(CCD_DOUBLE)
set(CCD_SINGLE OFF)
endif()
elseif(ENABLE_DOUBLE_PRECISION)
set(CCD_DOUBLE ON)
set(CCD_SINGLE OFF)
else()
set(CCD_DOUBLE OFF)
set(CCD_SINGLE ON)
endif()
configure_file(ccd/config.h.cmake.in ccd/config.h)
set(CCD_INCLUDES
ccd/ccd.h
ccd/compiler.h
ccd/ccd_export.h
ccd/quat.h
ccd/vec3.h
"${CMAKE_CURRENT_BINARY_DIR}/ccd/config.h")
set(CCD_SOURCES
alloc.h
ccd.c
dbg.h
list.h
mpr.c
polytope.c
polytope.h
simplex.h
support.c
support.h
vec3.c)
add_library(ccd ${CCD_INCLUDES} ${CCD_SOURCES})
set_target_properties(ccd PROPERTIES
PUBLIC_HEADER "${CCD_INCLUDES}"
SOVERSION ${CCD_SOVERSION}
VERSION ${CCD_VERSION})
target_include_directories(ccd PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
if(NOT WIN32)
find_library(LIBM_LIBRARY NAMES m)
if(NOT LIBM_LIBRARY)
message(FATAL_ERROR "Could NOT find required library LibM")
endif()
target_link_libraries(ccd "${LIBM_LIBRARY}")
if(BUILD_SHARED_LIBS)
set(CCD_PKGCONFIG_EXTRA_LIBS -lm PARENT_SCOPE)
endif()
endif()
export(TARGETS ccd FILE "${CMAKE_BINARY_DIR}/ccd-targets.cmake")
install(TARGETS ccd
EXPORT ccd-targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ccd"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(EXPORT ccd-targets DESTINATION "${CMAKE_INSTALL_LIBDIR}/ccd")
macro (check_compiler_visibility)
include (CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fvisibility=hidden COMPILER_SUPPORTS_VISIBILITY)
endmacro()
if(UNIX)
check_compiler_visibility()
if (COMPILER_SUPPORTS_VISIBILITY)
set_target_properties(ccd
PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
endif()
endif()
if(NOT WIN32 AND BUILD_TESTING AND NOT CCD_HIDE_ALL_SYMBOLS)
add_subdirectory(testsuites)
endif()