/[svn]/liblscp/trunk/CMakeLists.txt
ViewVC logotype

Contents of /liblscp/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4032 - (show annotations) (download)
Sat Mar 5 17:12:43 2022 UTC (2 years, 1 month ago) by capela
File MIME type: text/plain
File size: 4680 byte(s)
- Lowered cmake minimum version to 3.13.
1 cmake_minimum_required (VERSION 3.13)
2
3 project (liblscp
4 VERSION 0.9.6
5 DESCRIPTION "LinuxSampler Control Protocol API library"
6 LANGUAGES C)
7
8 set (CONFIG_VERSION ${PROJECT_VERSION})
9 execute_process (
10 COMMAND git describe --tags --dirty --abbrev=6
11 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
12 OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT
13 RESULT_VARIABLE GIT_DESCRIBE_RESULT
14 OUTPUT_STRIP_TRAILING_WHITESPACE)
15 if (GIT_DESCRIBE_RESULT EQUAL 0)
16 set (VERSION "${GIT_DESCRIBE_OUTPUT}")
17 string (REGEX REPLACE "^[^0-9]+" "" VERSION "${VERSION}")
18 string (REGEX REPLACE "^1_" "" VERSION "${VERSION}")
19 string (REGEX REPLACE "^[_vV]+" "" VERSION "${VERSION}")
20 string (REGEX REPLACE "-g" "git." VERSION "${VERSION}")
21 string (REGEX REPLACE "[_|-]" "." VERSION "${VERSION}")
22 execute_process (
23 COMMAND git rev-parse --abbrev-ref HEAD
24 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
25 OUTPUT_VARIABLE GIT_REVPARSE_OUTPUT
26 RESULT_VARIABLE GIT_REVPARSE_RESULT
27 OUTPUT_STRIP_TRAILING_WHITESPACE)
28 if (GIT_REVPARSE_RESULT EQUAL 0 AND NOT GIT_REVPARSE_OUTPUT STREQUAL "master")
29 set (VERSION "${VERSION} [${GIT_REVPARSE_OUTPUT}]")
30 endif ()
31 else ()
32 set (VERSION "${PROJECT_VERSION}")
33 endif ()
34
35 set (PACKAGE_NAME "liblscp")
36 set (PACKAGE_VERSION "${VERSION}")
37 set (PACKAGE_BUGREPORT "rncbc@rncbc.org")
38 set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
39 set (PACKAGE_TARNAME "liblscp")
40
41 set (ac_version "${PROJECT_VERSION}")
42 set (ac_prefix "${CMAKE_INSTALL_PREFIX}")
43
44 set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
45
46 include (GNUInstallDirs)
47 set (CONFIG_LIBDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
48 set (CONFIG_INCLUDEDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
49
50 set (ac_libdir "${CONFIG_LIBDIR}")
51 set (ac_includedir "${CONFIG_INCLUDEDIR}")
52
53 #------------------------------------------------------------------------------------
54 # Rules for library version information:
55 #
56 # 1. Start with version information of `0:0:0' for each libtool library.
57 # 2. Update the version information only immediately before a public release of
58 # your software. More frequent updates are unnecessary, and only guarantee
59 # that the current interface number gets larger faster.
60 # 3. If the library source code has changed at all since the last update, then
61 # increment revision (`c:r:a' becomes `c:r+1:a').
62 # 4. If any interfaces have been added, removed, or changed since the last update,
63 # increment current, and set revision to 0.
64 # 5. If any interfaces have been added since the last public release, then increment
65 # age.
66 # 6. If any interfaces have been removed since the last public release, then set age
67 # to 0.
68 #
69 #set (BUILD_SHARED_LIBS ON)
70
71 set (SHARED_VERSION_CURRENT 6)
72 set (SHARED_VERSION_AGE 0)
73 set (SHARED_VERSION_REVISION 4)
74 set (SHARED_VERSION_INFO "${SHARED_VERSION_CURRENT}.${SHARED_VERSION_AGE}.${SHARED_VERSION_REVISION}")
75
76 if (CONFIG_DEBUG)
77 set (CMAKE_BUILD_TYPE "Debug")
78 endif ()
79 if (CMAKE_BUILD_TYPE MATCHES "Debug")
80 set (CONFIG_DEBUG 1)
81 endif ()
82 if (CONFIG_DEBUG)
83 set (CONFIG_BUILD_TYPE "debug")
84 else ()
85 set (CONFIG_BUILD_TYPE "release")
86 endif ()
87
88 set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
89
90 include (GNUInstallDirs)
91 set (CONFIG_BINDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_BINDIR}")
92 set (CONFIG_LIBDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
93 set (CONFIG_DATADIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_DATADIR}")
94 set (CONFIG_INCLUDEDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
95
96 #
97 # No special build options...
98 #
99
100 # Fix for new CMAKE_REQUIRED_LIBRARIES policy.
101 if (POLICY CMP0075)
102 cmake_policy (SET CMP0075 NEW)
103 endif ()
104
105 include (CheckIncludeFiles)
106 include (CheckFunctionExists)
107
108 # Checks for standard header files.
109 if (UNIX AND NOT APPLE)
110 check_include_files ("stdlib.h;string.h;netdb.h;arpa/inet.h;netinet/tcp.h;netinet/in.h;sys/socket.h;unistd.h" HAVE_HEADERS_H)
111 if (NOT HAVE_HEADERS_H)
112 message (FATAL_ERROR "*** Standard headers not found.")
113 endif ()
114 endif ()
115
116 # Checks for standard functions.
117 if (UNIX AND NOT APPLE)
118 set (FUNCS "strdup;strtok_r;memset;memmove;socket;connect;bind;listen;setsockopt;getsockopt;getsockname;gethostbyname")
119 foreach (FUNC ${FUNCS})
120 check_function_exists (${FUNC} HAVE_${FUNC}_C)
121 if (NOT HAVE_${FUNC}_C)
122 message (FATAL_ERROR "*** Standard functions not found.")
123 endif ()
124 endforeach ()
125 endif ()
126
127 #
128 # No additional packages or libraries...
129 #
130
131 add_subdirectory (src)
132 add_subdirectory (doc)
133 add_subdirectory (examples)
134
135 configure_file (liblscp.spec.in liblscp.spec IMMEDIATE @ONLY)
136
137 configure_file (lscp.pc.in lscp.pc IMMEDIATE @ONLY)
138
139 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/lscp.pc
140 DESTINATION ${CONFIG_LIBDIR}/pkgconfig)
141

  ViewVC Help
Powered by ViewVC