-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
118 lines (96 loc) · 3.54 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Project presets
#
# Configurure the server now as: "cmake <OPTIONS> <FLAGS> .."
#
# Options:
#
# Flags:
#
# -DCMAKE_CXX_COMPILER= /usr/bin/g++
# -DCMAKE_INSTALL_PREFIX=/opt/phoenix
# -DCMAKE_BUILD_TYPE=debug | -DCMAKE_BUILD_TYPE=release
# Commons
PROJECT("Egg::Registry" CXX)
CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR)
# Describe project
SET ( PROJECT_VERSION_MAJOR 0 )
SET ( PROJECT_VERSION_MINOR 1 )
SET ( PROJECT_VERSION_PATCH 0 )
SET ( PROJECT_VERSION_TWEAK 1 )
SET ( PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK} )
STRING( TIMESTAMP TODAY "%d/%m/%Y" )
SET ( ABIMajor 1 )
SET ( ABIMinor 0 )
SET ( ABIPatch 0 )
SET ( ABIVersion ${ABIMajor}.${ABIMinor}.${ABIPatch} )
SET ( LibraryName "egg-registry"
CACHE STRING "Egg (Linux daemon SDK) registry library ${PROJECT_VERSION}. ABI: ${ABIVersion}" FORCE )
SET ( LibraryFullName "egg-registry-full"
CACHE STRING "Egg (Linux daemon SDK) registry library ${PROJECT_VERSION}. ABI: ${ABIVersion}" FORCE )
SET ( Alias "Go cat go" )
SET ( Author "Vladislav \\\"Tanuki\\\" Mikhailikov" )
SET ( Copyright "GNU GPLv3" )
SET ( Description "Egg (Linux daemon SDK) registry library" )
SET ( SDKName "EggSDK" )
# Common build paramteres
OPTION ( BUILD_SHARED_LIBS "Build shared libraries if ON or static if OFF" ON )
OPTION ( BUILD_PKGCONFIG "Generate pkgconfig configuration files" ON )
OPTION ( BUILD_TESTS "Build tests" OFF )
# Project directories
SET ( Project_Include_Dir "${CMAKE_SOURCE_DIR}/include" )
SET ( Project_Source_Dir "${CMAKE_SOURCE_DIR}/source" )
# Library search paths
SET ( LIBRARY_SEARCH_PATH "/lib" )
SET ( LIBRARY_SEARCH_PATH "${LIBRARY_SEARCH_PATH} /lib32" )
SET ( LIBRARY_SEARCH_PATH "${LIBRARY_SEARCH_PATH} /lib64" )
SET ( LIBRARY_SEARCH_PATH "${LIBRARY_SEARCH_PATH} /usr/lib" )
SET ( LIBRARY_SEARCH_PATH "${LIBRARY_SEARCH_PATH} /usr/lib32" )
SET ( LIBRARY_SEARCH_PATH "${LIBRARY_SEARCH_PATH} /usr/lib64" )
# GNU install dirs
INCLUDE ( GNUInstallDirs )
# Load cmake script
INCLUDE ( ${CMAKE_INSTALL_FULL_DATAROOTDIR}/cmake/${SDKName}/egg-common.cmake )
IF (NOT EggFound)
MESSAGE ( ERROR "Egg::System script not found!" )
ENDIF ()
# Load cmake script
INCLUDE ( ${CMAKE_INSTALL_FULL_DATAROOTDIR}/cmake/${SDKName}/egg-variable.cmake )
IF ( NOT EggVariableIncludePath OR
NOT EggVariableLibraryPath OR
NOT EggVariableLibraryName )
MESSAGE ( ERROR "Egg::Variable library not found!" )
ELSE ()
FIND_LIBRARY (
VARIABLE_LIBRARY
${EggVariableLibraryName}
${EggVariableLibraryPath} )
ENDIF ()
# Includes
ADD_SUBDIRECTORY ( include )
# Sources
ADD_SUBDIRECTORY ( source )
# CMake scripts
CONFIGURE_FILE(
egg-registry.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/egg-registry.cmake
@ONLY )
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/egg-registry.cmake
DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/cmake/${SDKName} )
# PkgConfig
IF (BUILD_PKGCONFIG)
CONFIGURE_FILE(
egg-registry.pc.in
${CMAKE_CURRENT_BINARY_DIR}/egg-registry.pc
@ONLY )
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/egg-registry.pc
DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig)
ENDIF ()
# Tests
IF (BUILD_TESTS)
ENABLE_TESTING()
INCLUDE (CTest)
ADD_SUBDIRECTORY ( test )
ENDIF ()
# End of file