Skip to content

Commit

Permalink
cmake: fix build without pkg-config (issue #2424)
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed May 8, 2019
1 parent 68ca351 commit a94334a
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

This comment has been minimized.

Copy link
@linquize

linquize May 15, 2019

AND NOT Leptonica_DIR breaks the build

This comment has been minimized.

Copy link
@zdenop

zdenop May 16, 2019

Author Contributor

Your comment is useless: I have 4 (2x Windows and 2xlinux) build setups where it works.
Provide detail how reproduce problem.

This comment has been minimized.

Copy link
@linquize

linquize May 16, 2019

The env I used was Travis CI linux. Currently master branch is broken

This comment has been minimized.

Copy link
@zdenop

zdenop May 16, 2019

Author Contributor

About broken travis build I known and I will fixed it later.

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)
Expand Down

0 comments on commit a94334a

Please sign in to comment.