Skip to content
This repository was archived by the owner on Aug 1, 2022. It is now read-only.

Commit db1512a

Browse files
committed
build: add support for installing from CMake
We can now install the library, manpage, and pkg-config data from CMake. At this point, for Linux, FreeBSD, Windows, and android, cmake is sufficient and should be treated as the canonical build system. Bump CMake requirement to 3.4.3. This should be old enough to be generally available and matches what LLVM, clang, and swift support as a minimum requirement.
1 parent 03eb969 commit db1512a

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

CMakeLists.txt

+23-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515
#
1616

17-
cmake_minimum_required(VERSION 2.8.4)
17+
cmake_minimum_required(VERSION 3.4.3)
1818
cmake_policy(SET CMP0063 OLD)
1919

20-
project(pthread_workqueue C)
20+
project(pthread_workqueue VERSION 0.9.4 LANGUAGES C)
2121

2222
set(CMAKE_C_VISIBILITY_PRESET hidden)
2323
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -32,6 +32,7 @@ set(THREADS_PREFER_PTHREADS_FLAG TRUE)
3232
find_package(Threads REQUIRED)
3333

3434
include(CheckIncludeFiles)
35+
include(GNUInstallDirs)
3536

3637
if(ENABLE_TESTS)
3738
check_include_files(err.h HAVE_ERR_H)
@@ -136,3 +137,23 @@ if(ENABLE_TESTS)
136137
add_subdirectory(testing)
137138
endif()
138139

140+
configure_file("${PROJECT_SOURCE_DIR}/libpthread_workqueue.pc.in"
141+
"${CMAKE_BINARY_DIR}/libpthread_workqueue.pc")
142+
143+
install(TARGETS
144+
pthread_workqueue
145+
DESTINATION
146+
${CMAKE_INSTALL_FULL_LIBDIR})
147+
install(FILES
148+
${PTHREAD_WORKQUEUE_HEADERS}
149+
DESTINATION
150+
${CMAKE_INSTAL_FULL_INCLUDEDIR})
151+
install(FILES
152+
${PROJECT_SOURCE_DIR}/pthread_workqueue.3
153+
DESTINATION
154+
${CMAKE_INSTALL_FULL_MANDIR})
155+
install(FILES
156+
${CMAKE_BINARY_DIR}/libpthread_workqueue.pc
157+
DESTINATION
158+
${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig)
159+

libpthread_workqueue.pc.in

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
prefix=@@PREFIX@@
1+
prefix=@CMAKE_INSTALL_PREFIX@
22
exec_prefix=${prefix}
3-
libdir=@@LIBDIR@@
4-
includedir=@@INCLUDEDIR@@
3+
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
4+
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
55

6-
Name: @@PROGRAM@@
6+
Name: pthread_workqueue
77
Description: Emulates pthread_workqueue(3) API
8-
Version: @@VERSION@@
9-
Requires:
10-
Libs: @@LIBDEPENDS@@ -lpthread
11-
Libs.private: @@LIBDEPENDS@@
8+
Version: @PROJECT_VERSION@
9+
Requires:
10+
Libs: -lpthread
11+
Libs.private:

0 commit comments

Comments
 (0)