cmake: fix build without pkg-config (issue #2424)

This commit is contained in:
zdenop 2019-05-08 18:49:48 +02:00 committed by Stefan Weil
parent 5320320b63
commit ee024e0209

View File

@ -142,16 +142,19 @@ endif()
# #
############################################################################### ###############################################################################
if(NOT CPPAN_BUILD) if(NOT CPPAN_BUILD AND NOT Leptonica_DIR)
find_package(PkgConfig) find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} CONFIG QUIET)
if (NOT Leptonica_DIR AND NOT MSVC AND COMMAND pkg_check_modules) if (NOT Leptonica_FOUND)
if(NOT PKG_CONFIG_EXECUTABLE) find_package(PkgConfig QUIET)
message(FATAL_ERROR "Missing required pkg-config") if(PKG_CONFIG_EXECUTABLE)
pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
link_directories(${Leptonica_LIBRARY_DIRS})
endif(PKG_CONFIG_EXECUTABLE)
# message ("Leptonica: ${Leptonica_LIBRARY_DIRS}, ${Leptonica_FOUND}")
if (NOT Leptonica_FOUND)
message(FATAL_ERROR "Cannot find required library Leptonica. Quitting!")
endif() endif()
pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
link_directories(${Leptonica_LIBRARY_DIRS})
else()
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG)
endif() endif()
else() else()
if (STATIC) if (STATIC)