[CMake] pkg-config: generate correct library link file names

This commit is contained in:
Mathis Logemann 2021-10-01 20:42:57 +02:00
parent 8c83e15404
commit 333e745d7b

View file

@ -1,4 +1,4 @@
function(create_pkg_config_file _lib_name _description) function(create_pkg_config_file _target _lib_name _description)
string(CONFIGURE [[ string(CONFIGURE [[
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
@ -8,7 +8,7 @@ libdir=${exec_prefix}/lib
Name: @_lib_name@ Name: @_lib_name@
Description: @_description@ Description: @_description@
Version: @MAPNIK_VERSION@ Version: @MAPNIK_VERSION@
Libs: -L"${libdir}" -l@_lib_name@ Libs: -L"${libdir}" -l$<TARGET_FILE_PREFIX:@_target@>$<TARGET_FILE_BASE_NAME:@_target@>$<TARGET_PROPERTY:@_target@,$<CONFIG>_POSTFIX>
Cflags: -I"${includedir}" ]] Cflags: -I"${includedir}" ]]
_contents @ONLY) _contents @ONLY)
@ -38,7 +38,7 @@ Name: @_lib_name@
Description: @_description@ Description: @_description@
Version: @MAPNIK_VERSION@ Version: @MAPNIK_VERSION@
Requires: libmapnikwkt libmapnikjson Requires: libmapnikwkt libmapnikjson
Libs: -L"${libdir}" -l@_lib_name@ -llibmapnikwkt -llibmapnikjson Libs: -L"${libdir}" -l$<TARGET_FILE_PREFIX:mapnik>$<TARGET_FILE_BASE_NAME:mapnik>$<TARGET_PROPERTY:mapnik,$<CONFIG>_POSTFIX> -l$<TARGET_FILE_PREFIX:json>$<TARGET_FILE_BASE_NAME:json>$<TARGET_PROPERTY:json,$<CONFIG>_POSTFIX> -l$<TARGET_FILE_PREFIX:wkt>$<TARGET_FILE_BASE_NAME:wkt>$<TARGET_PROPERTY:wkt,$<CONFIG>_POSTFIX>
Cflags: -I"${includedir}" @_str_compile_defs@]] Cflags: -I"${includedir}" @_str_compile_defs@]]
_contents @ONLY) _contents @ONLY)
file(GENERATE file(GENERATE
@ -52,6 +52,6 @@ Cflags: -I"${includedir}" @_str_compile_defs@]]
endfunction() endfunction()
create_pkg_config_file(libmapnikwkt "wkt library") create_pkg_config_file(wkt libmapnikwkt "wkt library")
create_pkg_config_file(libmapnikjson "json library") create_pkg_config_file(json libmapnikjson "json library")
create_pkg_config_file_mapnik("libmapnik" "mapnik library") create_pkg_config_file_mapnik("libmapnik" "mapnik library")