forked from fmidev/smartmet-library-newbase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
76 lines (64 loc) · 1.92 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
cmake_minimum_required(VERSION 3.7.1)
project(Newbase)
if(WIN32)
set(CMAKE_MFC_FLAG 0)
endif()
include(cmake/${CMAKE_SYSTEM_NAME}.cmake OPTIONAL)
file( GLOB SOURCE_FILES newbase/* )
add_library(
${PROJECT_NAME}
${SOURCE_FILES}
)
if(NOT Boost_INCLUDE_DIRS)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.60.0 QUIET COMPONENTS filesystem regex thread)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
endif()
endif()
target_include_directories(
${PROJECT_NAME}
PUBLIC ${PROJECT_SOURCE_DIR}/newbase
PUBLIC ${BOOST_INCLUDE_DIR}
)
set(
${PROJECT_NAME}_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/newbase
${PROJECT_SOURCE_DIR}
${BOOST_INCLUDE_DIR}
CACHE INTERNAL "${PROJECT_NAME}: Include Directories" FORCE
)
install(DIRECTORY newbase/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/newbase
FILES_MATCHING PATTERN "*.h")
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(DIRECTORY cmake/ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/newbase
FILES_MATCHING PATTERN "*onfig.cmake")
# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
add_custom_target(
uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(
${PROJECT_NAME}
${Fmt_LIBRARIES}
${GDAL_LIBRARY}
${Boost_LIBRARIES}
)
include(cmake/package.cmake OPTIONAL)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if (Fmt_FOUND)
target_link_libraries(${PROJECT_NAME} fmt::fmt-header-only)
endif()
endif()