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)
find_package(PkgConfig)
if (NOT Leptonica_DIR AND NOT MSVC AND COMMAND pkg_check_modules)
if(NOT PKG_CONFIG_EXECUTABLE)
message(FATAL_ERROR "Missing required pkg-config")
if(NOT CPPAN_BUILD AND NOT Leptonica_DIR)
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} CONFIG QUIET)
if (NOT Leptonica_FOUND)
find_package(PkgConfig QUIET)
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()
pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
link_directories(${Leptonica_LIBRARY_DIRS})
else()
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG)
endif()
else()
if (STATIC)