forked from nmwsharp/geometry-central
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (51 loc) · 1.87 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
cmake_minimum_required(VERSION 3.14.0)
project(geometry-central)
### Policy settings
cmake_policy(SET CMP0054 NEW) # don't implicitly dereference inside if()
### Process settings
option(BUILD_SHARED_LIBS "Build the shared library" FALSE)
if(BUILD_SHARED_LIBS)
message("-- Building SHARED libraries")
else()
message("-- Building STATIC libraries")
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # look for stuff in the /cmake directory
include(UpdateCacheVariable)
# Work with non-standard homebrew installations
# (from ceres build system)
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
find_program(HOMEBREW_EXECUTABLE brew)
mark_as_advanced(FORCE HOMEBREW_EXECUTABLE)
if (HOMEBREW_EXECUTABLE)
# Detected a Homebrew install, query for its install prefix.
execute_process(COMMAND ${HOMEBREW_EXECUTABLE} --prefix
OUTPUT_VARIABLE HOMEBREW_INSTALL_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Detected Homebrew with install prefix: "
"${HOMEBREW_INSTALL_PREFIX}, adding to CMake search paths.")
list(APPEND CMAKE_PREFIX_PATH "${HOMEBREW_INSTALL_PREFIX}")
endif()
endif()
### Handle windows-specific fixes
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_definitions (-DNOMINMAX) # don't use weird windows built-in min/max
add_definitions (-D_USE_MATH_DEFINES) # match unix behavior of constants in cmath
endif()
### Do anything needed for dependencies and bring their stuff in to scope
add_subdirectory(deps)
# copy variables set by deps upward
SET(GC_HAVE_SUITESPARSE ${GC_HAVE_SUITESPARSE} PARENT_SCOPE)
### Recurse to the source code
add_subdirectory(src)
# install
install(
TARGETS geometry-central
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/include/
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.ipp")