Merge pull request #220 from rolk/220_pkgconf
Make pkg-config functional again
This commit is contained in:
commit
54f516e468
@ -1,14 +1,7 @@
|
|||||||
function (configure_la name target)
|
# translate a list of libraries into a command-line that can be passed to the
|
||||||
if (NOT (UNIX OR MSYS OR MINGW))
|
# compiler/linker. first parameter is the name of the variable that will
|
||||||
return ()
|
# receive this list, the rest is considered the list of libraries
|
||||||
endif (NOT (UNIX OR MSYS OR MINGW))
|
function (linker_cmdline what INTO outvar FROM)
|
||||||
|
|
||||||
# these generic variables are initialized from the project info
|
|
||||||
set (current "${${name}_VERSION_MAJOR}")
|
|
||||||
set (age "${${name}_VERSION_MINOR}")
|
|
||||||
set (inherited_linker_flags "${${name}_LINKER_FLAGS}")
|
|
||||||
set (dependency_libs "${${name}_LIBRARIES}")
|
|
||||||
|
|
||||||
# if we are going to put these in regexps, we must escape period
|
# if we are going to put these in regexps, we must escape period
|
||||||
string (REPLACE "." "\\." esc_dl_pref "${CMAKE_SHARED_LIBRARY_PREFIX}")
|
string (REPLACE "." "\\." esc_dl_pref "${CMAKE_SHARED_LIBRARY_PREFIX}")
|
||||||
string (REPLACE "." "\\." esc_dl_suff "${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
string (REPLACE "." "\\." esc_dl_suff "${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||||
@ -19,7 +12,7 @@ function (configure_la name target)
|
|||||||
# (you get an error message about argument not parsed). translate each
|
# (you get an error message about argument not parsed). translate each
|
||||||
# of the libraries into a linker option
|
# of the libraries into a linker option
|
||||||
set (deplib_list "")
|
set (deplib_list "")
|
||||||
foreach (deplib IN LISTS dependency_libs)
|
foreach (deplib IN LISTS ARGN)
|
||||||
# starts with a hyphen already? then just add it
|
# starts with a hyphen already? then just add it
|
||||||
string (SUBSTRING ${deplib} 0 1 dash)
|
string (SUBSTRING ${deplib} 0 1 dash)
|
||||||
if (${dash} STREQUAL "-")
|
if (${dash} STREQUAL "-")
|
||||||
@ -61,8 +54,30 @@ function (configure_la name target)
|
|||||||
endif (deplib_orig STREQUAL deplib_name)
|
endif (deplib_orig STREQUAL deplib_name)
|
||||||
endif (${dash} STREQUAL "-")
|
endif (${dash} STREQUAL "-")
|
||||||
endforeach (deplib)
|
endforeach (deplib)
|
||||||
set (dependency_libs ${deplib_list})
|
# caller determines whether we want it returned as a list or a string
|
||||||
|
if ("${what}" STREQUAL "LIST")
|
||||||
|
set (${outvar} ${deplib_list})
|
||||||
|
else ("${what}" STREQUAL "LIST")
|
||||||
|
set (${outvar} "${deplib_list}")
|
||||||
|
string (REPLACE ";" " " ${outvar} "${${outvar}}")
|
||||||
|
endif ("${what}" STREQUAL "LIST")
|
||||||
|
set (${outvar} "${${outvar}}" PARENT_SCOPE)
|
||||||
|
endfunction (linker_cmdline what INTO outvar FROM)
|
||||||
|
|
||||||
|
function (configure_la name target)
|
||||||
|
if (NOT (UNIX OR MSYS OR MINGW))
|
||||||
|
return ()
|
||||||
|
endif (NOT (UNIX OR MSYS OR MINGW))
|
||||||
|
|
||||||
|
# these generic variables are initialized from the project info
|
||||||
|
set (current "${${name}_VERSION_MAJOR}")
|
||||||
|
set (age "${${name}_VERSION_MINOR}")
|
||||||
|
set (inherited_linker_flags "${${name}_LINKER_FLAGS}")
|
||||||
|
set (dependency_libs "${${name}_LIBRARIES}")
|
||||||
|
|
||||||
|
# translate list of libraries to command line
|
||||||
|
linker_cmdline (LIST INTO dependency_libs FROM ${dependency_libs})
|
||||||
|
|
||||||
# convert from CMake list (i.e. semi-colon separated)
|
# convert from CMake list (i.e. semi-colon separated)
|
||||||
string (REPLACE ";" " " inherited_linker_flags "${inherited_linker_flags}")
|
string (REPLACE ";" " " inherited_linker_flags "${inherited_linker_flags}")
|
||||||
string (REPLACE ";" " " dependency_libs "${dependency_libs}")
|
string (REPLACE ";" " " dependency_libs "${dependency_libs}")
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# - Helper routines for opm-core like projects
|
# - Helper routines for opm-core like projects
|
||||||
|
|
||||||
|
include (LibtoolArchives) # linker_cmdline
|
||||||
|
|
||||||
# convert a list back to a command-line string
|
# convert a list back to a command-line string
|
||||||
function (unseparate_args var_name prefix value)
|
function (unseparate_args var_name prefix value)
|
||||||
separate_arguments (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)
|
function (configure_pc_file name source dest prefix libdir includedir)
|
||||||
# escape set of standard strings
|
# escape set of standard strings
|
||||||
unseparate_args (includes "-I" "${${name}_INCLUDE_DIRS}")
|
unseparate_args (includes "-I" "${${name}_INCLUDE_DIRS}")
|
||||||
unseparate_args (libs "-l" "${${name}_LIBRARIES}")
|
|
||||||
unseparate_args (defs "" "${${name}_DEFINITIONS}")
|
unseparate_args (defs "" "${${name}_DEFINITIONS}")
|
||||||
|
linker_cmdline (STRING INTO libs FROM ${${name}_LIBRARIES})
|
||||||
|
|
||||||
# necessary to make these variables visible to configure_file
|
# necessary to make these variables visible to configure_file
|
||||||
set (name "${${name}_NAME}")
|
set (name "${${name}_NAME}")
|
||||||
set (description "${${name}_DESCRIPTION}")
|
set (description "${${name}_DESCRIPTION}")
|
||||||
set (target "${${name}_LIBRARY}")
|
|
||||||
set (major "${${name}_VERSION_MAJOR}")
|
set (major "${${name}_VERSION_MAJOR}")
|
||||||
set (minor "${${name}_VERSION_MINOR}")
|
set (minor "${${name}_VERSION_MINOR}")
|
||||||
|
set (target "${${name}_LIBRARY}")
|
||||||
|
linker_cmdline (STRING INTO target from ${target})
|
||||||
|
|
||||||
configure_file (${source} ${dest} @ONLY)
|
configure_file (${source} ${dest} @ONLY)
|
||||||
endfunction (configure_pc_file name source dist prefix libdir includedir)
|
endfunction (configure_pc_file name source dist prefix libdir includedir)
|
||||||
|
@ -9,5 +9,5 @@ Name: @name@
|
|||||||
Description: @description@ @major@.@minor@
|
Description: @description@ @major@.@minor@
|
||||||
Version: @major@.@minor@
|
Version: @major@.@minor@
|
||||||
URL: http://opm-project.org
|
URL: http://opm-project.org
|
||||||
Libs: -l@target@ @libs@
|
Libs: @target@ @libs@
|
||||||
Cflags: @includes@ @defs@
|
Cflags: @includes@ @defs@
|
||||||
|
Loading…
Reference in New Issue
Block a user