]> granicus.if.org Git - json-c/commitdiff
Installation directories empty with CMake in pkg-config.
authorJehan <jehan@girinstud.io>
Sat, 26 Jan 2019 11:30:40 +0000 (12:30 +0100)
committerJehan <jehan@girinstud.io>
Sat, 26 Jan 2019 11:30:40 +0000 (12:30 +0100)
CMake was not properly substituting the installation dir variables (they
ended up all empty), so the pkg-config results were also wrongs. For
instance cflags was: -I -I/json-c
Even though json-c was found at configure time, this obviously broke the
build of any application using it.

CMakeLists.txt

index d4a1afbc328c09723ae875e3561b2bc00a003e79..7fcd74d8d5f26be77a3796ada86774cc1172a416 100644 (file)
@@ -259,6 +259,12 @@ install(TARGETS ${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})
     configure_file(json-c.pc.in json-c.pc @ONLY)
     set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
     install(FILES ${PROJECT_BINARY_DIR}/json-c.pc DESTINATION "${INSTALL_PKGCONFIG_DIR}")