-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
71 lines (58 loc) · 1.96 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
### gftools cmake configuration
cmake_minimum_required (VERSION 3.1)
# gftools use only CXX compiler
project (GFTools CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Disable build in source
if (${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
message(FATAL_ERROR "In source builds are disabled. Please use a separate build directory.")
endif()
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
# find additional cmake module in cmake dir
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# Print build type
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
# doxygen
set(DOXYFILE_SOURCE_DIR "./gftools")
include(UseDoxygen)
### Dependencies
# Eigen3
find_package (Eigen3 3.1)
message(STATUS "Eigen3 includes: " ${EIGEN3_INCLUDE_DIR} )
# Boost
find_package (Boost)
include_directories(
${EIGEN3_INCLUDE_DIR}
#${EIGEN3_INCLUDE_DIR}/unsupported
${Boost_INCLUDE_DIRS}
./gftools
)
add_library(gftools INTERFACE)
target_include_directories(gftools INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
install(TARGETS gftools EXPORT gftools-config)
install(DIRECTORY gftools DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(EXPORT gftools-config DESTINATION share/gftools/cmake)
option(Testing "Enable testing" OFF)
if (Testing)
message(STATUS "Building tests")
include(EnableGtests)
add_subdirectory(test)
enable_testing()
endif (Testing)
# Build example
option(Examples "Build examples" OFF)
if (Examples)
message(STATUS "Building examples")
add_subdirectory(example)
endif (Examples)
# Generate pkg-config file
configure_file("${CMAKE_SOURCE_DIR}/gftools.pc.in" "${CMAKE_BINARY_DIR}/gftools.pc")
configure_file("${CMAKE_SOURCE_DIR}/gftools.hpp" "${CMAKE_BINARY_DIR}/gftools.hpp")
install(FILES "${CMAKE_BINARY_DIR}/gftools.pc" DESTINATION "lib/pkgconfig")
install(FILES "${CMAKE_BINARY_DIR}/gftools.hpp" DESTINATION include)