Commit 77c2669bd13976730ff163c34a829d22806aafa4

Martin Mitas 2019-08-09T10:15:05

Update generating pkgconfig .pc files. * Output also package URL. * Output also package description. * Output also package version. * Generate .pc file for the new renderer lib.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4771420..4e71960 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,9 @@ set(MD_VERSION_MINOR 4)
 set(MD_VERSION_RELEASE 3)
 set(MD_VERSION "${MD_VERSION_MAJOR}.${MD_VERSION_MINOR}.${MD_VERSION_RELEASE}")
 
+set(PROJECT_VERSION "${MD_VERSION}")
+set(PROJECT_URL "https://github.com/mity/md4c")
+
 if(WIN32)
     # On Windows, given there is no standard lib install dir etc., we rather
     # by default build static lib.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2feb647..f84849c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,11 +1,11 @@
 
 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 1)
 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
-configure_file(md4c.pc.in md4c.pc @ONLY)
 
 
 # Build rules for MD4C parser library
 
+configure_file(md4c.pc.in md4c.pc @ONLY)
 add_library(md4c md4c.c md4c.h)
 set_target_properties(md4c PROPERTIES
     COMPILE_FLAGS "-DMD4C_USE_UTF8"
@@ -17,6 +17,7 @@ set_target_properties(md4c PROPERTIES
 
 # Build rules for HTML renderer library
 
+configure_file(md4c-html.pc.in md4c-html.pc @ONLY)
 add_library(md4c-html md4c-html.c md4c-html.h entity.c entity.h)
 set_target_properties(md4c-html PROPERTIES
     VERSION ${MD_VERSION}
@@ -42,6 +43,20 @@ install(
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
     PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
 )
+install(FILES ${CMAKE_BINARY_DIR}/src/md4c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+install(EXPORT md4cConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/md4c/)
+
+install(
+    TARGETS md4c-html
+    EXPORT md4cHtmlConfig
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+install(FILES ${CMAKE_BINARY_DIR}/src/md4c-html.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+install(EXPORT md4cHtmlConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/md4c-html/)
+
 install(
     TARGETS md2html
     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -49,7 +64,5 @@ install(
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
     PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
 )
-install(EXPORT md4cConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/md4c/)
-install(FILES ${CMAKE_BINARY_DIR}/src/md4c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
 install(FILES "md2html.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
 
diff --git a/src/md4c-html.pc.in b/src/md4c-html.pc.in
new file mode 100644
index 0000000..504bb52
--- /dev/null
+++ b/src/md4c-html.pc.in
@@ -0,0 +1,13 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+Name: @PROJECT_NAME@ HTML renderer
+Description: Markdown to HTML converter library.
+Version: @PROJECT_VERSION@
+URL: @PROJECT_URL@
+
+Requires: md4c = @PROJECT_VERSION@
+Libs: -L${libdir} -lmd4c-html
+Cflags: -I${includedir}
diff --git a/src/md4c.pc.in b/src/md4c.pc.in
index 61c78d8..cd8842d 100644
--- a/src/md4c.pc.in
+++ b/src/md4c.pc.in
@@ -4,8 +4,9 @@ libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
 includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
 
 Name: @PROJECT_NAME@
-Description: @PROJECT_DESCRIPTION@
+Description: Markdown parser library with a SAX-like callback-based interface.
 Version: @PROJECT_VERSION@
+URL: @PROJECT_URL@
 
 Requires:
 Libs: -L${libdir} -lmd4c