forked from fmidev/smartmet-library-smarttools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
78 lines (65 loc) · 1.95 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
cmake_minimum_required(VERSION 3.7.1)
project(SmartTools)
if(WIN32)
set(CMAKE_MFC_FLAG 2)
else()
add_compile_options(-std=c++11 -DUNIX)
endif()
add_definitions(
-DFMI_SUPPORT_STATION_DATA_SMARTTOOL
)
file( GLOB SOURCE_FILES smarttools/* )
add_library(
${PROJECT_NAME} STATIC
${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 ()
if (NOT Newbase_INCLUDE_DIRS)
find_package(Newbase QUIET)
if (Newbase_FOUND)
include_directories(${Newbase_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${Newbase_LIBRARIES})
endif ()
endif ()
# Uninstall old files
find_package(SmartTools QUIET)
if (SmartTools_FOUND)
include(${SmartTools_CONFIG})
file(GLOB INSTALLED_FILES
${SmartTools_DIR}
${SmartTools_INSTALLED_INCLUDE_DIRS}
${SmartTools_INSTALLED_LIBRARIES})
add_custom_target(uninstall rm -rf ${INSTALLED_FILES})
endif()
target_link_libraries(
${PROJECT_NAME}
Newbase
)
target_include_directories(
${PROJECT_NAME}
PUBLIC ${PROJECT_SOURCE_DIR}/smarttools
PUBLIC ${Newbase_INCLUDE_DIRS}
PUBLIC ${BOOST_INCLUDE_DIR}
)
set(
${PROJECT_NAME}_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/smarttools
${PROJECT_SOURCE_DIR}
${Newbase_INCLUDE_DIRS}
${BOOST_INCLUDE_DIR}
CACHE INTERNAL "${PROJECT_NAME}: Include Directories" FORCE
)
install(DIRECTORY smarttools/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/smarttools
FILES_MATCHING PATTERN "*.h")
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(DIRECTORY cmake/ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/smarttools
FILES_MATCHING PATTERN "*onfig.cmake")