CMake: Fix pkg-config section "Libs" for MSVC

This commit is contained in:
Sebastian Pipping 2022-03-24 16:36:29 +01:00
parent 896e94000c
commit 7165ae8bff
2 changed files with 6 additions and 2 deletions

View File

@ -442,7 +442,10 @@ if(WIN32 AND NOT MINGW)
# NOTE: "set_property(TARGET expat PROPERTY PREFIX lib)" would only affect *.dll
# files but not *.lib files, so we have to rely on property OUTPUT_NAME, instead.
# Property CMAKE_*_POSTFIX still applies.
set_property(TARGET expat PROPERTY OUTPUT_NAME libexpat)
set(_EXPAT_OUTPUT_NAME libexpat)
set_property(TARGET expat PROPERTY OUTPUT_NAME ${_EXPAT_OUTPUT_NAME})
else()
set(_EXPAT_OUTPUT_NAME expat)
endif()
target_include_directories(expat
@ -494,6 +497,7 @@ if(EXPAT_BUILD_PKGCONFIG)
string(TOLOWER "${_build_type}" _build_type_lower)
string(TOUPPER "${_build_type}" _build_type_upper)
set_property(TARGET expat PROPERTY "pkgconfig_${_build_type_lower}_name" "expat${CMAKE_${_build_type_upper}_POSTFIX}")
set_property(TARGET expat PROPERTY "pkgconfig_${_build_type_lower}_output_name" "${_EXPAT_OUTPUT_NAME}${CMAKE_${_build_type_upper}_POSTFIX}")
if(_EXPAT_LIBM_FOUND)
set_property(TARGET expat PROPERTY "pkgconfig_libm" "-lm")
else()

View File

@ -7,6 +7,6 @@ Name: $<TARGET_PROPERTY:expat,pkgconfig_$<LOWER_CASE:$<CONFIG>>_name>
Version: $<TARGET_PROPERTY:expat,pkgconfig_version>
Description: expat XML parser
URL: https://libexpat.github.io/
Libs: -L${libdir} -l$<TARGET_PROPERTY:expat,pkgconfig_$<LOWER_CASE:$<CONFIG>>_name>
Libs: -L${libdir} -l$<TARGET_PROPERTY:expat,pkgconfig_$<LOWER_CASE:$<CONFIG>>_output_name>
Libs.private: $<TARGET_PROPERTY:expat,pkgconfig_libm>
Cflags: -I${includedir}