mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Check for needed magic functions before using libmagic
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40795 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c53fb6fed9
commit
77a31ee0f2
@ -28,6 +28,20 @@
|
|||||||
|
|
||||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||||
|
|
||||||
|
include(CheckFunctionExists)
|
||||||
|
macro(check_magic_functions_exists _varname)
|
||||||
|
set(${_varname} 1)
|
||||||
|
if (Magic_LIBRARY)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${Magic_LIBRARY})
|
||||||
|
endif()
|
||||||
|
foreach(fkt file open load close error)
|
||||||
|
check_function_exists(magic_${fkt} HAS_function_magic_${fkt})
|
||||||
|
if (NOT HAS_function_magic_${fkt})
|
||||||
|
set(${_varname} 0)
|
||||||
|
message(STATUS "Function magic_${fkt} not found")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
if (Magic_INCLUDE_DIR)
|
if (Magic_INCLUDE_DIR)
|
||||||
# Already in cache, be silent
|
# Already in cache, be silent
|
||||||
set(Magic_FIND_QUIETLY TRUE)
|
set(Magic_FIND_QUIETLY TRUE)
|
||||||
@ -39,9 +53,9 @@ find_path(Magic_INCLUDE_DIR magic.h PATHS
|
|||||||
|
|
||||||
find_library(Magic_LIBRARY NAMES "magic")
|
find_library(Magic_LIBRARY NAMES "magic")
|
||||||
|
|
||||||
include(CheckFunctionExists)
|
check_magic_functions_exists(HAS_MAGIC_FUNCTIONS)
|
||||||
check_function_exists(magic_open HAVE_HAVE_MAGIC_OPEN)
|
|
||||||
if(Magic_INCLUDE_DIR AND Magic_LIBRARY)
|
if(Magic_INCLUDE_DIR AND Magic_LIBRARY AND HAS_MAGIC_FUNCTIONS)
|
||||||
set(Magic_FOUND TRUE)
|
set(Magic_FOUND TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user