From: Pavel Zwerschke Date: Mon, 17 Jun 2024 22:11:13 +0000 (+0200) Subject: Build pkg-config for msvc as well X-Git-Tag: json-c-0.18-20240915~6^2~1 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b8d170d1fd7e3187ad4d3ff673ebbbf5528a882;p=thirdparty%2Fjson-c.git Build pkg-config for msvc as well --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5015408..2ff2f66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -543,35 +543,29 @@ install( DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) -if (UNIX OR MINGW OR CYGWIN) - SET(prefix ${CMAKE_INSTALL_PREFIX}) - # exec_prefix is prefix by default and CMake does not have the - # concept. - SET(exec_prefix ${CMAKE_INSTALL_PREFIX}) - SET(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) - SET(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) - SET(VERSION ${PROJECT_VERSION}) - - # Linking against the static json-c requires - # dependent packages to include additional libs: - SET(LIBS_LIST ${CMAKE_REQUIRED_LIBRARIES}) - - # Note: We would need cmake >= 3.12 in order to use list(TRANSFORM ...) - function(list_transform_prepend var prefix) - set(temp "") - foreach(f ${${var}}) - list(APPEND temp "${prefix}${f}") - endforeach() - set(${var} "${temp}" PARENT_SCOPE) - endfunction() - list_transform_prepend(LIBS_LIST "-l") - - string(REPLACE ";" " " LIBS "${LIBS_LIST}") - - configure_file(json-c.pc.in json-c.pc @ONLY) - set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") - install(FILES ${PROJECT_BINARY_DIR}/json-c.pc DESTINATION "${INSTALL_PKGCONFIG_DIR}") -endif () +SET(prefix ${CMAKE_INSTALL_PREFIX}) +# exec_prefix is prefix by default and CMake does not have the +# concept. +SET(exec_prefix ${CMAKE_INSTALL_PREFIX}) +SET(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) +SET(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) +SET(VERSION ${PROJECT_VERSION}) +# Linking against the static json-c requires +# dependent packages to include additional libs: +SET(LIBS_LIST ${CMAKE_REQUIRED_LIBRARIES}) +# Note: We would need cmake >= 3.12 in order to use list(TRANSFORM ...) +function(list_transform_prepend var prefix) + set(temp "") + foreach(f ${${var}}) + list(APPEND temp "${prefix}${f}") + endforeach() + set(${var} "${temp}" PARENT_SCOPE) +endfunction() +list_transform_prepend(LIBS_LIST "-l") +string(REPLACE ";" " " LIBS "${LIBS_LIST}") +configure_file(json-c.pc.in json-c.pc @ONLY) +set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") +install(FILES ${PROJECT_BINARY_DIR}/json-c.pc DESTINATION "${INSTALL_PKGCONFIG_DIR}") install(FILES ${JSON_C_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/json-c)