Write cmdline in .pc file without abs paths

When passing libraries to gcc/ld, the search path and library name must
be specified separately. This is already done when writing a libtool .la
and should be done in the pkg-config .pc file too.
This commit is contained in:
Roland Kaufmann
2013-03-22 13:44:06 +01:00
parent 6d72c94d0c
commit 1dd608358c
2 changed files with 6 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
# - Helper routines for opm-core like projects
include (LibtoolArchives) # linker_cmdline
# convert a list back to a command-line string
function (unseparate_args var_name prefix value)
separate_arguments (value)
@@ -18,15 +20,16 @@ endfunction (unseparate_args var_name prefix value)
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}")
unseparate_args (defs "" "${${name}_DEFINITIONS}")
linker_cmdline (STRING INTO libs FROM ${${name}_LIBRARIES})
# necessary to make these variables visible to configure_file
set (name "${${name}_NAME}")
set (description "${${name}_DESCRIPTION}")
set (target "${${name}_LIBRARY}")
set (major "${${name}_VERSION_MAJOR}")
set (minor "${${name}_VERSION_MINOR}")
set (target "${${name}_LIBRARY}")
linker_cmdline (STRING INTO target from ${target})
configure_file (${source} ${dest} @ONLY)
endfunction (configure_pc_file name source dist prefix libdir includedir)

View File

@@ -9,5 +9,5 @@ Name: @name@
Description: @description@ @major@.@minor@
Version: @major@.@minor@
URL: http://opm-project.org
Libs: -l@target@ @libs@
Libs: @target@ @libs@
Cflags: @includes@ @defs@