Skip to content

Commit

Permalink
Add pkg-config support
Browse files Browse the repository at this point in the history
  • Loading branch information
tfc committed Dec 3, 2023
1 parent 1c91f40 commit 41749e8
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 1 deletion.
19 changes: 18 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.16)
project(rapidcheck CXX)

# Don't warn about symbol visibility for static libraries with CMake 3.3 and later.
Expand Down Expand Up @@ -122,3 +122,20 @@ add_subdirectory(extras)
# Install the export file specifying all the targets for RapidCheck
install(EXPORT rapidcheckConfig DESTINATION share/rapidcheck/cmake)
export(EXPORT rapidcheckConfig FILE rapidcheckConfig.cmake)

set(PKG_CONFIG_REQUIRES)
set(PKG_CONFIG_DESCRIPTION_SUMMARY "C++ framework for property based testing inspired by QuickCheck and other similar frameworks")
set(PKG_CONFIG_VERSION)
set(PKG_CONFIG_LIBDIR "\${prefix}/lib")
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/include")
set(PKG_CONFIG_LIBS)
set(PKG_CONFIG_CFLAGS "-I\${includedir}")

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
19 changes: 19 additions & 0 deletions extras/boost/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
project(rapidcheck_boost CXX)

add_library(rapidcheck_boost INTERFACE)
target_link_libraries(rapidcheck_boost INTERFACE rapidcheck)
target_include_directories(rapidcheck_boost INTERFACE
Expand All @@ -13,3 +15,20 @@ install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if (RC_ENABLE_TESTS)
add_subdirectory(test)
endif()

set(PKG_CONFIG_REQUIRES "rapidcheck")
set(PKG_CONFIG_DESCRIPTION_SUMMARY "boost headers for rapidcheck")
set(PKG_CONFIG_VERSION)
set(PKG_CONFIG_LIBDIR "\${prefix}/lib")
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/include")
set(PKG_CONFIG_LIBS)
set(PKG_CONFIG_CFLAGS "-I\${includedir}")

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/../../pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
19 changes: 19 additions & 0 deletions extras/boost_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
project(rapidcheck_boost_test CXX)

add_library(rapidcheck_boost_test INTERFACE)
target_link_libraries(rapidcheck_boost_test INTERFACE rapidcheck)
target_include_directories(rapidcheck_boost_test INTERFACE
Expand All @@ -9,3 +11,20 @@ target_include_directories(rapidcheck_boost_test INTERFACE
# and information on its targets.
install(TARGETS rapidcheck_boost_test EXPORT rapidcheckConfig)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

set(PKG_CONFIG_REQUIRES "rapidcheck")
set(PKG_CONFIG_DESCRIPTION_SUMMARY "boost_test headers for rapidcheck")
set(PKG_CONFIG_VERSION)
set(PKG_CONFIG_LIBDIR "\${prefix}/lib")
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/include")
set(PKG_CONFIG_LIBS)
set(PKG_CONFIG_CFLAGS "-I\${includedir}")

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/../../pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
19 changes: 19 additions & 0 deletions extras/catch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
project(rapidcheck_catch CXX)

add_library(rapidcheck_catch INTERFACE)
target_link_libraries(rapidcheck_catch INTERFACE rapidcheck)
target_include_directories(rapidcheck_catch INTERFACE
Expand All @@ -9,3 +11,20 @@ target_include_directories(rapidcheck_catch INTERFACE
# and information on its targets.
install(TARGETS rapidcheck_catch EXPORT rapidcheckConfig)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

set(PKG_CONFIG_REQUIRES "rapidcheck")
set(PKG_CONFIG_DESCRIPTION_SUMMARY "catch headers for rapidcheck")
set(PKG_CONFIG_VERSION)
set(PKG_CONFIG_LIBDIR "\${prefix}/lib")
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/include")
set(PKG_CONFIG_LIBS)
set(PKG_CONFIG_CFLAGS "-I\${includedir}")

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/../../pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
19 changes: 19 additions & 0 deletions extras/doctest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
project(rapidcheck_doctest CXX)

add_library(rapidcheck_doctest INTERFACE)
target_link_libraries(rapidcheck_doctest INTERFACE rapidcheck)
target_include_directories(rapidcheck_doctest INTERFACE
Expand All @@ -9,3 +11,20 @@ target_include_directories(rapidcheck_doctest INTERFACE
# and information on its targets.
install(TARGETS rapidcheck_doctest EXPORT rapidcheckConfig)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

set(PKG_CONFIG_REQUIRES "rapidcheck")
set(PKG_CONFIG_DESCRIPTION_SUMMARY "doctest headers for rapidcheck")
set(PKG_CONFIG_VERSION)
set(PKG_CONFIG_LIBDIR "\${prefix}/lib")
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/include")
set(PKG_CONFIG_LIBS)
set(PKG_CONFIG_CFLAGS "-I\${includedir}")

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/../../pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
19 changes: 19 additions & 0 deletions extras/gmock/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
project(rapidcheck_gtest CXX)

add_library(rapidcheck_gmock INTERFACE)
target_link_libraries(rapidcheck_gmock INTERFACE rapidcheck)
target_include_directories(rapidcheck_gmock INTERFACE
Expand All @@ -13,3 +15,20 @@ install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if (RC_ENABLE_TESTS)
add_subdirectory(test)
endif()

set(PKG_CONFIG_REQUIRES "rapidcheck")
set(PKG_CONFIG_DESCRIPTION_SUMMARY "gmock headers for rapidcheck")
set(PKG_CONFIG_VERSION)
set(PKG_CONFIG_LIBDIR "\${prefix}/lib")
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/include")
set(PKG_CONFIG_LIBS)
set(PKG_CONFIG_CFLAGS "-I\${includedir}")

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/../../pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
19 changes: 19 additions & 0 deletions extras/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
project(rapidcheck_gtest CXX)

add_library(rapidcheck_gtest INTERFACE)
target_link_libraries(rapidcheck_gtest INTERFACE rapidcheck)
target_include_directories(rapidcheck_gtest INTERFACE
Expand All @@ -9,3 +11,20 @@ target_include_directories(rapidcheck_gtest INTERFACE
# and information on its targets.
install(TARGETS rapidcheck_gtest EXPORT rapidcheckConfig)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

set(PKG_CONFIG_REQUIRES "rapidcheck")
set(PKG_CONFIG_DESCRIPTION_SUMMARY "gtest headers for rapidcheck")
set(PKG_CONFIG_VERSION)
set(PKG_CONFIG_LIBDIR "\${prefix}/lib")
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/include")
set(PKG_CONFIG_LIBS)
set(PKG_CONFIG_CFLAGS "-I\${includedir}")

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/../../pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
9 changes: 9 additions & 0 deletions pkg-config.pc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Name: ${PROJECT_NAME}
Description: ${PKG_CONFIG_DESCRIPTION_SUMMARY}
Version: ${PKG_CONFIG_VERSION}
Requires: ${PKG_CONFIG_REQUIRES}
prefix=${CMAKE_INSTALL_PREFIX}
includedir=${PKG_CONFIG_INCLUDEDIR}
libdir=${PKG_CONFIG_LIBDIR}
Libs: ${PKG_CONFIG_LIBS}
Cflags: ${PKG_CONFIG_CFLAGS}

0 comments on commit 41749e8

Please sign in to comment.