summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorVitaly Zaitsev <vitaly@easycoding.org>2018-07-12 16:16:13 +0500
committermujx <mujx@users.noreply.github.com>2018-07-12 14:16:13 +0300
commit824563e38a0bbccb8186a02b720e14b73936114a (patch)
tree7efb718737d7f62554b72c88d6e442682e45ca8c /cmake
parent363e3735f13fb5d2f03078bfc7146dd0487bd6ce (diff)
Added FindOlm.cmake script from mtxclient to find generic libolm packaged without cmake support. (#370)
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindOlm.cmake40
1 files changed, 40 insertions, 0 deletions
diff --git a/cmake/FindOlm.cmake b/cmake/FindOlm.cmake
new file mode 100644
index 00000000..aaccdb0c
--- /dev/null
+++ b/cmake/FindOlm.cmake
@@ -0,0 +1,40 @@
+#
+# CMake module to search for the olm library
+#
+# On success, the macro sets the following variables:
+# OLM_FOUND = if the library found
+# OLM_LIBRARY = full path to the library
+# OLM_INCLUDE_DIR = where to find the library headers
+#
+
+find_path(OLM_INCLUDE_DIR
+ NAMES olm/olm.h
+ PATHS /usr/include
+ /usr/local/include
+ $ENV{LIB_DIR}/include
+ $ENV{LIB_DIR}/include/olm)
+
+find_library(OLM_LIBRARY
+ NAMES olm
+ PATHS /usr/lib /usr/local/lib $ENV{LIB_DIR}/lib)
+
+if(OLM_FOUND)
+ set(OLM_INCLUDE_DIRS ${OLM_INCLUDE_DIR})
+
+ if(NOT OLM_LIBRARIES)
+ set(OLM_LIBRARIES ${OLM_LIBRARY})
+ endif()
+endif()
+
+if(NOT TARGET Olm::Olm)
+ add_library(Olm::Olm UNKNOWN IMPORTED)
+ set_target_properties(Olm::Olm
+ PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
+ ${OLM_INCLUDE_DIR})
+ set_property(TARGET Olm::Olm APPEND PROPERTY IMPORTED_LOCATION ${OLM_LIBRARY})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OLM DEFAULT_MSG OLM_INCLUDE_DIR OLM_LIBRARY)
+
+mark_as_advanced(OLM_LIBRARY OLM_INCLUDE_DIR)