summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2014-10-09 03:17:02 +0200
committerSlávek Banko <slavek.banko@axis.cz>2014-10-09 03:17:48 +0200
commit03a61295af97983a2313df9717653a466c99ef03 (patch)
treea322176b1ec239813aa19066af0245eb3452b32d /CMakeLists.txt
parente1eaf5a90159b023cb4c0c9e5c68acba397c1457 (diff)
downloadtdelibs-03a61295af97983a2313df9717653a466c99ef03.tar.gz
tdelibs-03a61295af97983a2313df9717653a466c99ef03.zip
Fix FTBFS on missing magic_getpath
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11d3c4bfe..e02891634 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -525,6 +525,26 @@ if( NOT HAVE_LIBDL )
endif( NOT HAVE_LIBDL )
+##### check for magic ###########################
+
+set( MAGIC_LIBRARIES magic )
+check_library_exists( ${MAGIC_LIBRARIES} magic_load "" HAVE_LIBMAGIC )
+if( HAVE_LIBMAGIC )
+ check_library_exists( ${MAGIC_LIBRARIES} magic_getpath "" HAVE_LIBMAGIC_GETPATH )
+ if( NOT HAVE_LIBMAGIC_GETPATH )
+ execute_process(
+ COMMAND file --version
+ OUTPUT_VARIABLE LIBMAGIC_VERSION
+ ERROR_VARIABLE LIBMAGIC_VERSION
+ )
+ string(REGEX REPLACE ".*magic file from ([^ \n]*).*" "\\1" LIBMAGIC_PATH ${LIBMAGIC_VERSION} )
+ message( STATUS "libmagick default path ${LIBMAGIC_PATH}" )
+ endif( NOT HAVE_LIBMAGIC_GETPATH )
+else( HAVE_LIBMAGIC )
+ tde_message_fatal( "libmagic is required, but not found on your system" )
+endif( HAVE_LIBMAGIC )
+
+
##### check for utempter ########################
if( WITH_UTEMPTER )