-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
98 lines (84 loc) · 3.08 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
cmake_minimum_required(VERSION 2.6.2)
project(omm)
set(OMM_VERSION_MAJOR 0)
set(OMM_VERSION_MINOR 1)
set(OMM_VERSION_PATCH 0)
set(OMM_VERSION "${OMM_VERSION_MAJOR}.${OMM_VERSION_MINOR}.${OMM_VERSION_PATCH}")
add_definitions(-D__OMM_VERSION_STRING__="${OMM_VERSION}")
# determine build and target system and set variables for cross compiling
if(CMAKE_CROSSCOMPILING)
message(STATUS "Host system: " ${CMAKE_HOST_SYSTEM_NAME})
message(STATUS "Building for target system: " ${CMAKE_SYSTEM_NAME})
else(CMAKE_CROSSCOMPILING)
message(STATUS "Building native for system: " ${CMAKE_SYSTEM_NAME})
endif(CMAKE_CROSSCOMPILING)
# override BUILD_TARGET if not specified
if(LINUX OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(LINUX 1)
set(BUILD_TARGET "Linux")
add_definitions(-D__LINUX__)
elseif(APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(DARWIN 1)
set(MACOSX 1)
add_definitions(-D__DARWIN__)
add_definitions(-D__MACOSX__)
# set install_name for libraries on Darwin
set(CMAKE_INSTALL_NAME_DIR
${CMAKE_INSTALL_PREFIX}/lib
)
elseif(WINDOWS OR ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(WINDOWS 1)
add_definitions(-D__WINDOWS__)
set(BUILD_TARGET "Windows")
elseif(NOT BUILD_TARGET)
set(BUILD_TARGET "Native")
endif(LINUX OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# iphone or iphone-simulator
if("${BUILD_TARGET}" MATCHES "iphone")
set(DARWIN 1)
set(IPHONE 1)
add_definitions(-D__DARWIN__)
add_definitions(-D__IPHONE__)
endif("${BUILD_TARGET}" MATCHES "iphone")
message(STATUS "Build target is: " ${BUILD_TARGET})
# iphone only
if("${BUILD_TARGET}" STREQUAL iphone)
# use hardware floating point ops on simulator and softemu on iphone device
add_definitions(-msoft-float)
endif("${BUILD_TARGET}" STREQUAL iphone)
add_definitions(-Wno-unused-parameter)
get_property(BUILD_SHARED_LIBS
GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
set(CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/cmake
${CMAKE_MODULE_PATH}
)
# check basic dependency Poco
find_package(POCO REQUIRED)
# set OMM lib and plugin includes
set(libdir "${CMAKE_CURRENT_SOURCE_DIR}/src/lib")
if(IS_DIRECTORY ${libdir})
# omm libs are in the source tree so build them first and use internal headers
message(STATUS "Using internal OMM libraries")
include_directories(src/include)
else(IS_DIRECTORY ${libdir})
message(STATUS "Search for external OMM libraries ...")
find_package(OMM REQUIRED)
endif(IS_DIRECTORY ${libdir})
set(plugindir "${CMAKE_CURRENT_SOURCE_DIR}/src/plugin")
if(IS_DIRECTORY ${plugindir})
# omm plugins are in the source tree so build them first and use internal headers
message(STATUS "Using internal OMM plugins")
include_directories(${plugindir}/include)
else(IS_DIRECTORY ${plugindir})
message(STATUS "Search for external OMM plugins ...")
find_package(OMMPLUGIN)
endif(IS_DIRECTORY ${plugindir})
# set Poco includes. Must be after OMM headers because Poco and OMM could be
# in staging dir and internal OMM headers are always prefered.
include_directories(${POCO_INCLUDE_DIRS})
# build what is available in the source tree (libs, plugins, apps, tests)
add_subdirectory(src)
# CPack related for creating binary distribution packages
include(ConfigurePackager)
include(CPack)