summaryrefslogtreecommitdiff
path: root/3rdparty/plibsys/CMakeLists.txt
blob: 8a4758582dad1aafc58cdd222fb5b799f2f53166 (plain)
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
# The MIT License
#
# Copyright (C) 2018-2019 Alexander Saprykin <saprykin.spb@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


set (CMAKE_LEGACY_CYGWIN_WIN32 0)

cmake_minimum_required (VERSION 2.8.0)
project (plibsys C)

set (PLIBSYS_VERSION_MAJOR 0)
set (PLIBSYS_VERSION_MINOR 0)
set (PLIBSYS_VERSION_PATCH 4)
set (PLIBSYS_VERSION_NUM 0x000004)
set (PLIBSYS_VERSION ${PLIBSYS_VERSION_MAJOR}.${PLIBSYS_VERSION_MINOR}.${PLIBSYS_VERSION_PATCH})
set (PLIBSYS_SOVERSION ${PLIBSYS_VERSION_MAJOR})
set (VERSION ${PLIBSYS_VERSION})

set (top_srcdir ${PROJECT_SOURCE_DIR})

option (PLIBSYS_TESTS "Build unit tests" OFF)
option (PLIBSYS_BUILD_STATIC "Also build static version of the library" ON)
option (PLIBSYS_COVERAGE "Enable gcov coverage (GCC and Clang)" OFF)
option (PLIBSYS_VISIBILITY "Use explicit symbols visibility if possible" OFF)
option (PLIBSYS_BUILD_DOC "Enable building HTML documentation" OFF)

if (NOT CMAKE_BUILD_TYPE)
        set (CMAKE_BUILD_TYPE "Debug")
endif()

subdirs (src)

if (PLIBSYS_TESTS)
        enable_testing ()
        subdirs (tests)
endif()

if (PLIBSYS_BUILD_DOC)
        find_package (Doxygen)

        if (DOXYGEN_FOUND)
                configure_file (${PROJECT_SOURCE_DIR}/Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile)

                add_custom_target (doc ALL
                        COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
                        WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
                        COMMENT "Generating API documentation with Doxygen"
                        VERBATIM
                )

                install (DIRECTORY ${PROJECT_BINARY_DIR}/doc/html DESTINATION share/doc)
        endif()
endif()

set (CPACK_PACKAGE_NAME ${PROJECT_NAME}-installer)
set (CPACK_PACKAGE_VENDOR "Alexander Saprykin")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME} - System routines library")
set (CPACK_PACKAGE_VERSION_MAJOR ${PLIBSYS_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${PLIBSYS_VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH ${PLIBSYS_VERSION_PATCH})
set (CPACK_PACKAGE_VERSION ${PLIBSYS_VERSION})
set (CPACK_PACKAGE_INSTALL_DIRECTORY ${PROJECT_NAME}-${CPACK_PACKAGE_VERSION})
set (CPACK_COMPONENTS_ALL Core)
set (CPACK_COMPONENT_CORE_DISPLAY_NAME "Core components")
set (CPACK_COMPONENT_CORE_DESCRIPTION "Core library with headers")
set (CPACK_COMPONENT_CORE_REQUIRED TRUE)

if (WIN32 AND NOT UNIX)
        set (CPACK_NSIS_DISPLAY_NAME ${PROJECT_NAME})
elseif (UNIX)
        set (CPACK_GENERATOR STGZ)
endif()

include (CPack)