From 1f23390623c13a138e1e4baaefcba511ce22b207 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 30 Jul 2019 12:48:11 +0200 Subject: [PATCH] Added pkg-config file. --- CMakeLists.txt | 12 ++++++++---- README.md | 2 +- example.c | 4 ++-- example.cpp | 2 +- identiconpp.pc.in | 12 ++++++++++++ identiconpp_c.pc.in | 11 +++++++++++ 6 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 identiconpp.pc.in create mode 100644 identiconpp_c.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 9008de7..bc6ed63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,11 +26,15 @@ install(FILES README.md DESTINATION ${CMAKE_INSTALL_DOCDIR}) add_subdirectory(src) -# configure_file("${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.pc.in" -# "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" @ONLY) +configure_file("${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.pc.in" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" @ONLY) +configure_file("${PROJECT_SOURCE_DIR}/${PROJECT_NAME}_c.pc.in" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_c.pc" @ONLY) -# install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" -# DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_c.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") if(WITH_TESTS) add_subdirectory(tests) diff --git a/README.md b/README.md index 26db9ee..f5f8640 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ The "sigil" algorithm generates the same results as ### Example ```C++ -// Compile with g++ $(Magick++-config --cppflags --ldflags) -lidenticonpp +// Compile with g++ $(pkg-config --libs --cflags identiconpp) #include #include #include diff --git a/example.c b/example.c index 8eb7297..7e08bde 100644 --- a/example.c +++ b/example.c @@ -1,8 +1,8 @@ /* This file is part of identiconpp. * Public Domain / CC-0 * - * Compile with gcc --std=c99 $(pkg-config --cflags --libs MagickWand) \ - * $(pkg-config --cflags --libs openssl) -lidenticonpp + * Compile with gcc --std=c99 \ + * $(pkg-config --cflags --libs identiconpp_c.pc MagickWand openssl) */ #include diff --git a/example.cpp b/example.cpp index 4b2aaec..4e4d067 100644 --- a/example.cpp +++ b/example.cpp @@ -1,7 +1,7 @@ /* This file is part of identiconpp. * Public Domain / CC-0 * - * Compile with g++ $(Magick++-config --cppflags --ldflags) -lidenticonpp + * Compile with g++ $(pkg-config --libs --cflags identiconpp) */ #include diff --git a/identiconpp.pc.in b/identiconpp.pc.in new file mode 100644 index 0000000..004485d --- /dev/null +++ b/identiconpp.pc.in @@ -0,0 +1,12 @@ +name=@PROJECT_NAME@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ + +Name: ${name} +Description: Library to generate identicons for C++ and C. +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -l${name} +Cflags: -I${includedir} +Requires: Magick++ diff --git a/identiconpp_c.pc.in b/identiconpp_c.pc.in new file mode 100644 index 0000000..b56574a --- /dev/null +++ b/identiconpp_c.pc.in @@ -0,0 +1,11 @@ +name=@PROJECT_NAME@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ + +Name: ${name} +Description: Library to generate identicons for C++ and C. +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -l${name} +Cflags: -I${includedir}