Added pkg-config file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 85e954e..eef9aaa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,7 @@
OPTION(JSONCPP_WITH_TESTS "Compile and run JsonCpp test executables" ON)
OPTION(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" ON)
OPTION(JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occurs" OFF)
+OPTION(JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON)
# Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix
IF(NOT WIN32)
@@ -51,6 +52,15 @@
UseCompilationWarningAsError()
ENDIF(JSONCPP_WITH_WARNING_AS_ERROR)
+IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
+ CONFIGURE_FILE(
+ "pkg-config/jsoncpp.pc.in"
+ "pkg-config/jsoncpp.pc"
+ @ONLY)
+ INSTALL(FILES "${CMAKE_BINARY_DIR}/pkg-config/jsoncpp.pc"
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
+ENDIF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
+
# Build the different applications
ADD_SUBDIRECTORY( src )
diff --git a/pkg-config/jsoncpp.pc.in b/pkg-config/jsoncpp.pc.in
new file mode 100644
index 0000000..12edd79
--- /dev/null
+++ b/pkg-config/jsoncpp.pc.in
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: jsoncpp
+Description: A C++ library for interacting with JSON
+URL: https://github.com/open-source-parsers/jsoncpp
+Libs: -L${libdir} -ljsoncpp
+Cflags: -I${includedir}