From 5304b05c9c44cb141036ea7c091c2195ccaaee41 Mon Sep 17 00:00:00 2001 From: Kirill Elagin Date: Wed, 18 Feb 2026 17:58:18 +0100 Subject: [PATCH 1/3] cmake: Set correct headers dir on the exported target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The header files were installed into `${CMAKE_INSTALL_INCLUDEDIR}` (correct), but the exported target was using a hardcoded `include` path for its headers location in its install interface. Set the directory in the target’s interface to where the headers are actually being installed. This will result in the exact same behaviour as before, if `${CMAKE_INSTALL_INCLUDEDIR}` is not overriden, as it defaults to `include`. However, when it was overriden, the resulting CMake config was unusable, and this fixes it. --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d55fdc51..2d1606c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,8 @@ option(RC_ENABLE_TESTS "Build RapidCheck tests" OFF) option(RC_ENABLE_EXAMPLES "Build RapidCheck examples" OFF) option(RC_ENABLE_RTTI "Build RapidCheck with RTTI" ON) +include(GNUInstallDirs) + if(MSVC) # /bigobj - some object files become very large so we need this # /wd4503 - truncation of decorated name, not much we can do about it so @@ -83,10 +85,9 @@ endif() target_include_directories(rapidcheck PUBLIC $ - $ # /include + $ ) -include(GNUInstallDirs) install(TARGETS rapidcheck EXPORT rapidcheckConfig RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # This is for Windows ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} From dffb749333fe514c2bf74a81ab3ed8eb9c778fa7 Mon Sep 17 00:00:00 2001 From: Kirill Elagin Date: Wed, 18 Feb 2026 18:16:22 +0100 Subject: [PATCH 2/3] pkgconfig: Fix and clean up the .pc file The .pc file was using hardcoded installdir and libdir locations, even though the headers were actually installed into their respective GNU dirs, which can be overriden by the user. Use the appropriate variables instead of the harcoded paths, and also clean up the file a bit to remove an extra layer of unnecessary variables in the CMake file. --- CMakeLists.txt | 6 ------ pkg-config.pc.cmake | 14 +++++++------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d1606c6..9120a83a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,13 +124,7 @@ add_subdirectory(extras) 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" diff --git a/pkg-config.pc.cmake b/pkg-config.pc.cmake index 182cf0e2..fea5c24e 100644 --- a/pkg-config.pc.cmake +++ b/pkg-config.pc.cmake @@ -1,9 +1,9 @@ +prefix=${CMAKE_INSTALL_PREFIX} +includedir=${CMAKE_INSTALL_FULL_INCLUDEDIR} +libdir=${CMAKE_INSTALL_FULL_LIBDIR} + 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} +Version: +Libs: -L${libdir} -lrapidcheck +Cflags: -I${includedir} From 62147ff70cb6dde93ba3f8627b666f65f2c6e52c Mon Sep 17 00:00:00 2001 From: Kirill Elagin Date: Wed, 18 Feb 2026 18:30:53 +0100 Subject: [PATCH 3/3] cmake: Install the CMake config to libdir Previously, the CMake config files for the package were installed into `share/cmake`. This location is usually reserved for CMake-specific modules/macros etc. Install to `lib/cmake` instead, to be consistent with the location of the `.pc` file, and also switch to using the corresponding GNU libdir variable. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9120a83a..81ea8c14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,7 @@ endif() add_subdirectory(extras) # Install the export file specifying all the targets for RapidCheck -install(EXPORT rapidcheckConfig DESTINATION share/rapidcheck/cmake) +install(EXPORT rapidcheckConfig DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") export(EXPORT rapidcheckConfig FILE rapidcheckConfig.cmake) set(PKG_CONFIG_DESCRIPTION_SUMMARY "C++ framework for property based testing inspired by QuickCheck and other similar frameworks")