-
Notifications
You must be signed in to change notification settings - Fork 35
/
CMakeLists.txt
75 lines (60 loc) · 1.71 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
cmake_minimum_required(VERSION 3.2)
project(CompactNSearch)
# Visual studio solution directories.
set_property(GLOBAL PROPERTY USE_FOLDERS on)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (UNIX)
find_package(OpenMP)
if (OPENMP_FOUND)
if (CMAKE_VERSION VERSION_GREATER "3.8")
link_libraries(OpenMP::OpenMP_CXX)
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif(OPENMP_FOUND)
endif (UNIX)
OPTION(BUILD_AS_SHARED_LIBS "Build all the libraries as shared" OFF)
if (BUILD_AS_SHARED_LIBS)
if(WIN32)
add_definitions(-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES CACHE BOOL "Export all symbols")
endif(WIN32)
endif (BUILD_AS_SHARED_LIBS)
SET(CMAKE_DEBUG_POSTFIX "_d")
set (HEADER_FILES
include/Config.h
include/CompactNSearch.h
include/PointSet.h
include/DataStructures.h)
if (BUILD_AS_SHARED_LIBS)
add_library(CompactNSearch SHARED
${HEADER_FILES}
src/CompactNSearch.cpp
)
else()
add_library(CompactNSearch
${HEADER_FILES}
src/CompactNSearch.cpp
)
endif ()
target_include_directories(CompactNSearch PUBLIC include)
if (APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
find_package(oneDPL REQUIRED)
target_link_libraries(CompactNSearch PUBLIC oneDPL)
endif()
install(FILES "include/CompactNSearch" ${HEADER_FILES}
DESTINATION include/)
install(TARGETS CompactNSearch
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
OPTION(USE_DOUBLE_PRECISION "Use double precision" ON)
if (USE_DOUBLE_PRECISION)
add_definitions( -DUSE_DOUBLE)
endif (USE_DOUBLE_PRECISION)
option(BUILD_DEMO "Build example of how to use this library."
ON)
if(BUILD_DEMO)
add_subdirectory(demo)
endif(BUILD_DEMO)