Skip to content

Commit 114bc50

Browse files
committed
improve cmake configuration
1 parent 0c2557f commit 114bc50

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

CMakeLists.txt

+9-5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ option(OPENMP_BUILD "Build with openmp support" OFF) # see issue #1662
7171
option(BUILD_TRAINING_TOOLS "Build training tools" ON)
7272
option(BUILD_TESTS "Build tests" OFF)
7373

74+
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.cppan)
75+
set(CPPAN_BUILD OFF)
76+
endif()
7477

7578
###############################################################################
7679
#
@@ -125,7 +128,7 @@ endif()
125128
#
126129
###############################################################################
127130

128-
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.cppan OR NOT CPPAN_BUILD)
131+
if(NOT CPPAN_BUILD)
129132
if (NOT Leptonica_DIR AND NOT MSVC)
130133
find_package(PkgConfig REQUIRED)
131134
pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
@@ -152,6 +155,7 @@ find_package(OpenCL QUIET)
152155

153156
set(AUTOCONFIG_SRC ${CMAKE_CURRENT_BINARY_DIR}/config_auto.h.in)
154157
set(AUTOCONFIG ${CMAKE_CURRENT_BINARY_DIR}/config_auto.h)
158+
add_definitions(-DHAVE_CONFIG_H)
155159

156160
include(Configure)
157161

@@ -329,13 +333,13 @@ else()
329333
set_target_properties (libtesseract PROPERTIES OUTPUT_NAME tesseract)
330334
endif()
331335

332-
if (NOT CPPAN_BUILD)
333-
target_link_libraries (libtesseract ${Leptonica_LIBRARIES})
334-
export(TARGETS libtesseract FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake)
335-
else()
336+
if (CPPAN_BUILD)
336337
target_link_libraries (libtesseract pvt.cppan.demo.danbloomberg.leptonica)
337338
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake "include(${CMAKE_CURRENT_BINARY_DIR}/cppan.cmake)\n")
338339
export(TARGETS libtesseract APPEND FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake)
340+
else()
341+
target_link_libraries (libtesseract ${Leptonica_LIBRARIES})
342+
export(TARGETS libtesseract FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake)
339343
endif()
340344

341345
if (WIN32 AND CLANG AND OPENMP_BUILD)

0 commit comments

Comments
 (0)