From 6f3a7baccde31948d22d2308e493eebf6d03f2e2 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Mon, 4 Feb 2013 11:18:58 +0100 Subject: [PATCH] Add standard variables/location hints There is a convention that one can do `pkg-config --variable=includedir` and have it return the path to the source files (even if that should have been taken care of by options in --cflags). --- cmake/Modules/OpmProject.cmake | 8 +++++--- opm-core.pc.in | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/OpmProject.cmake b/cmake/Modules/OpmProject.cmake index db6e8f2b..fcb5bb9d 100644 --- a/cmake/Modules/OpmProject.cmake +++ b/cmake/Modules/OpmProject.cmake @@ -15,7 +15,7 @@ function (unseparate_args var_name prefix value) endfunction (unseparate_args var_name prefix value) # wrapper to set variables in pkg-config file -function (configure_pc_file name source dest libdir includedir) +function (configure_pc_file name source dest prefix libdir includedir) # escape set of standard strings unseparate_args (includes "-I" "${${name}_INCLUDE_DIRS}") unseparate_args (libs "-l" "${${name}_LIBRARIES}") @@ -27,7 +27,7 @@ function (configure_pc_file name source dest libdir includedir) set (minor "${${name}_VERSION_MINOR}") configure_file (${source} ${dest} @ONLY) -endfunction (configure_pc_file name source dist libdir includedir) +endfunction (configure_pc_file name source dist prefix libdir includedir) # installation of CMake modules to help user programs locate the library function (opm_cmake_config name) @@ -52,6 +52,7 @@ function (opm_cmake_config name) ${name} ${PROJECT_SOURCE_DIR}/${name}.pc.in ${PROJECT_BINARY_DIR}/${name}.pc + ${PROJECT_BINARY_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${PROJECT_SOURCE_DIR} ) @@ -101,7 +102,8 @@ function (opm_cmake_config name) ${name} ${PROJECT_SOURCE_DIR}/${name}.pc.in ${PROJECT_BINARY_DIR}/${name}-install.pc - ${CMAKE_INSTALL_LIBDIR} + ${CMAKE_INSTALL_PREFIX} + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} ${CMAKE_INSTALL_PREFIX}/include ) diff --git a/opm-core.pc.in b/opm-core.pc.in index 584f8de2..1acbeb68 100644 --- a/opm-core.pc.in +++ b/opm-core.pc.in @@ -1,3 +1,10 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ +CXX=@CMAKE_CXX_COMPILER@ @CXX_STD0X_FLAGS@ @OpenMP_CXX_FLAGS@ +CC=@CMAKE_C_COMPILER@ @C_STD99_FLAGS@ @OpenMP_C_FLAGS@ +DEPENDENCIES= + Name: OPM Core Description: Open Porous Media Initiative Core Library @major@.@minor@ Version: @major@.@minor@