-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
86 lines (63 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
77
78
79
80
81
82
83
84
85
cmake_minimum_required(VERSION 3.10.0)
project(libopenrex)
set(MAJOR_VERSION 0)
set(MINOR_VERSION 1)
set(PACKAGE libopenrex)
set(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION})
set(VERSION ${VERSION_STRING})
set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# CMake
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_COLOR_MAKEFILE ON)
if(UNIX)
add_definitions(-D_POSIX_C_SOURCE=200809L -pedantic -std=c11 -Wall -Wno-format-truncation -fPIC)
endif()
add_definitions(-DVERSION=\"${VERSION}\")
if (OPENREX_STATIC_BUILD)
file(GLOB SOURCES ./src/*.c)
file(GLOB HEADERS ./src/*.h)
add_library(openrex STATIC ${SOURCES} ${HEADERS})
set_target_properties(openrex PROPERTIES POSITION_INDEPENDENT_CODE ON)
else()
include(CMakeOptions.txt)
# Testing
enable_testing()
# Debug build
message("-- Build type: ${CMAKE_BUILD_TYPE}")
if(${CMAKE_BUILD_TYPE} STREQUAL Debug)
add_definitions(-DDEBUG)
endif()
add_subdirectory(src)
add_subdirectory(extensions)
if (TOOLS)
add_subdirectory(tools)
endif()
if (IMPORTER)
add_subdirectory(importer)
endif()
if (VIEWER)
add_subdirectory(viewer)
endif()
if (TESTS)
add_subdirectory(test)
endif()
set ( LIBOPENREX_INCLUDE_DIR ${includedir} )
set ( LIBOPENREX_INCLUDE_DIRS ${LIBOPENREX_INCLUDE_DIR} )
set ( LIBOPENREX_LIBRARY openrex )
set ( LIBOPENREX_LIBRARIES ${LIBOPENREX_LIBRARY} )
set ( LIBOPENREX_STATIC_LIBRARY openrex.a )
set ( LIBOPENREX_STATIC_LIBRARIES ${LIBOPENREX_STATIC_LIBRARY} )
set ( LIBOPENREX_LIBRARY_DIRS ${libdir} )
set ( LIBOPENREX_ROOT_DIR ${prefix} )
set ( LIBOPENREX_VERSION_STRING ${VERSION_STRING} )
set ( LIBOPENREX_VERSION_MAJOR ${MAJOR_VERSION} )
set ( LIBOPENREX_VERSION_MINOR ${MINOR_VERSION} )
message (STATUS "Summary build options:
Build static libs: ${STATICLIBS}
Build tools: ${TOOLS}
Build viewer: ${VIEWER}
Build importer: ${IMPORTER}
")
endif()