aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJoakim Soderberg <joakim.soderberg@gmail.com>2014-01-10 16:50:33 +0100
committerJoakim Soderberg <joakim.soderberg@gmail.com>2014-01-24 14:13:02 +0100
commit913937c98d2b530292e35b7c3fb6c21b576698e9 (patch)
treec82cf220ccd27cfe406de3044c3ac9f89ece8728 /cmake
parentb21cd65d305f04b52c3c7cb1a33c63a2b1d7ad28 (diff)
downloadjansson-913937c98d2b530292e35b7c3fb6c21b576698e9.zip
jansson-913937c98d2b530292e35b7c3fb6c21b576698e9.tar.gz
jansson-913937c98d2b530292e35b7c3fb6c21b576698e9.tar.bz2
Added CMake config files.
This will simplify linking against the lib, both from the build-tree and install-tree from other CMake projects. CMakes find_package command uses these configs to locate the exported targets for the library. * Also changed so that all CMake options for the project are prepended with JANSSON_ so that there is no ambiguity when including this as a subdirectory in another CMake project.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/JanssonConfig.cmake.in17
-rw-r--r--cmake/JanssonConfigVersion.cmake.in11
2 files changed, 28 insertions, 0 deletions
diff --git a/cmake/JanssonConfig.cmake.in b/cmake/JanssonConfig.cmake.in
new file mode 100644
index 0000000..21af0ff
--- /dev/null
+++ b/cmake/JanssonConfig.cmake.in
@@ -0,0 +1,17 @@
+# - Config file for the Libevent package
+# It defines the following variables
+# LIBEVENT_INCLUDE_DIRS - include directories for FooBar
+# LIBEVENT_LIBRARIES - libraries to link against
+
+# Get the path of the current file.
+get_filename_component(JANSSON_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+# Set the include directories.
+set(JANSSON_INCLUDE_DIRS "@JANSSON__INCLUDE_DIRS@")
+
+# Include the project Targets file, this contains definitions for IMPORTED targets.
+include(${JANSSON_CMAKE_DIR}/JanssonTargets.cmake)
+
+# IMPORTED targets from LibeventTargets.cmake
+set(JANSSON_LIBRARIES event event_core event_extras)
+
diff --git a/cmake/JanssonConfigVersion.cmake.in b/cmake/JanssonConfigVersion.cmake.in
new file mode 100644
index 0000000..83b0d74
--- /dev/null
+++ b/cmake/JanssonConfigVersion.cmake.in
@@ -0,0 +1,11 @@
+set(PACKAGE_VERSION "@JANSSON_DISPLAY_VERSION@")
+
+# Check whether the requested PACKAGE_FIND_VERSION is compatible
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+endif()