Use GNUInstallDirs module

* `GNUInstallDirs` is a standardised way to
  change paths, which makes systems integration
  easier and allows for a more consistent user
  experience.
This commit is contained in:
David Seifert 2018-01-18 00:01:27 +01:00 committed by Martin Hořeňovský
parent f0f40a0dbf
commit 8d4074aad9
2 changed files with 6 additions and 7 deletions

View File

@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.0)
project(CatchSelfTest) project(CatchSelfTest)
include(GNUInstallDirs)
option(USE_VALGRIND "Perform SelfTests with Valgrind" OFF) option(USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
option(BUILD_EXAMPLES "Build documentation examples" OFF) option(BUILD_EXAMPLES "Build documentation examples" OFF)
option(ENABLE_COVERAGE "Generate coverage for codecov.io" OFF) option(ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
@ -366,14 +368,14 @@ if(BUILD_EXAMPLES)
add_subdirectory(examples) add_subdirectory(examples)
endif() endif()
install(DIRECTORY "single_include/" DESTINATION "include/catch") install(DIRECTORY "single_include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/catch")
## Provide some pkg-config integration ## Provide some pkg-config integration
# Don't bother on Windows # Don't bother on Windows
if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows) if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
set(PKGCONFIG_INSTALL_DIR set(PKGCONFIG_INSTALL_DIR
"${CMAKE_INSTALL_PREFIX}/share/pkgconfig" "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig"
CACHE PATH "Path where catch.pc is installed" CACHE PATH "Path where catch.pc is installed"
) )

View File

@ -1,9 +1,6 @@
prefix=@CMAKE_INSTALL_PREFIX@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
exec_prefix=${prefix}
Name: Catch Name: Catch
Description: Testing library for C++ Description: Testing library for C++
Requires:
Version: @CATCH_VERSION_NUMBER@ Version: @CATCH_VERSION_NUMBER@
Libs: Cflags: -I${includedir}
Cflags: -I${prefix}/@INCLUDE_INSTALL_DIR@/include