forked from foonathan/memory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (52 loc) · 2.69 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
# Copyright (C) 2015-2020 Jonathan Müller <[email protected]>
# This file is subject to the license terms in the LICENSE file
# found in the top-level directory of this distribution.
# root CMakeLists.txt, specifies option and interface library
cmake_minimum_required(VERSION 3.1)
project(FOONATHAN_MEMORY)
set(FOONATHAN_MEMORY_VERSION_MAJOR 0 CACHE STRING "major version of memory" FORCE)
set(FOONATHAN_MEMORY_VERSION_MINOR 6 CACHE STRING "minor version of memory" FORCE)
set(FOONATHAN_MEMORY_VERSION_PATCH 2 CACHE STRING "patch version of memory" FORCE)
set(FOONATHAN_MEMORY_VERSION "${FOONATHAN_MEMORY_VERSION_MAJOR}.${FOONATHAN_MEMORY_VERSION_MINOR}.${FOONATHAN_MEMORY_VERSION_PATCH}"
CACHE STRING "version of memory" FORCE)
# set a debug postfix
set(CMAKE_DEBUG_POSTFIX "-dbg")
# installation destinations
if(UNIX OR VXWORKS)
include(GNUInstallDirs)
set(FOONATHAN_MEMORY_INC_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/foonathan_memory")
set(FOONATHAN_MEMORY_RUNTIME_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
set(FOONATHAN_MEMORY_LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
set(FOONATHAN_MEMORY_ARCHIVE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
set(FOONATHAN_MEMORY_FRAMEWORK_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
set(FOONATHAN_MEMORY_CMAKE_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/foonathan_memory/cmake")
set(FOONATHAN_MEMORY_ADDITIONAL_FILES_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/foonathan_memory")
elseif(WIN32)
set(FOONATHAN_MEMORY_INC_INSTALL_DIR "include/foonathan_memory")
set(FOONATHAN_MEMORY_RUNTIME_INSTALL_DIR "bin")
set(FOONATHAN_MEMORY_LIBRARY_INSTALL_DIR "bin")
set(FOONATHAN_MEMORY_ARCHIVE_INSTALL_DIR "lib")
set(FOONATHAN_MEMORY_FRAMEWORK_INSTALL_DIR "bin")
set(FOONATHAN_MEMORY_CMAKE_CONFIG_INSTALL_DIR "share/foonathan_memory/cmake")
set(FOONATHAN_MEMORY_ADDITIONAL_FILES_INSTALL_DIR "share/foonathan_memory")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
else()
message(FATAL_ERROR "Could not set install folders for this platform!")
endif()
include(cmake/configuration.cmake)
# subdirectories
add_subdirectory(src)
if(FOONATHAN_MEMORY_BUILD_EXAMPLES)
add_subdirectory(example)
endif()
if(FOONATHAN_MEMORY_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()
if(FOONATHAN_MEMORY_BUILD_TOOLS)
add_subdirectory(tool)
endif()
# install readme and license
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" "${CMAKE_CURRENT_SOURCE_DIR}/README.md" DESTINATION ${FOONATHAN_MEMORY_ADDITIONAL_FILES_INSTALL_DIR})
install(EXPORT foonathan_memoryTargets DESTINATION ${FOONATHAN_MEMORY_CMAKE_CONFIG_INSTALL_DIR}
FILE foonathan_memory-config.cmake)