Skip to content

Fix and improve configuration for cmake builds #4437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,13 @@ if(SW_BUILD)
sw_execute()
else()
find_package(PkgConfig)
if(APPLE)
if(DEFINED ENV{HOMEBREW_PREFIX})
set(HOMEBREW_PREFIX $ENV{HOMEBREW_PREFIX})
set(PKG_CONFIG_PATH "${HOMEBREW_PREFIX}/opt/icu4c/lib/pkgconfig:${HOMEBREW_PREFIX}/opt/libarchive/lib/pkgconfig")
set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}")
endif()
endif()
# Check for required library. option -DLeptonica_DIR=path => cmake hint where
# to find leptonica
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} CONFIG)
Expand Down
2 changes: 1 addition & 1 deletion cmake/CheckFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function(check_leptonica_tiff_support)
# check if leptonica was build with tiff support set result to
# LEPT_TIFF_RESULT
set(TIFF_TEST
"#include \"leptonica/allheaders.h\"\n"
"#include \"allheaders.h\"\n"
"int main() {\n"
" l_uint8 *data = NULL;\n"
" size_t size = 0;\n"
Expand Down
8 changes: 2 additions & 6 deletions src/training/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ if(NOT ${CMAKE_VERSION} VERSION_LESS "3.12.0")
cmake_policy(SET CMP0074 NEW)
endif()

if(UNIX AND NOT ANDROID)
set(LIB_pthread pthread)
endif()

if(SW_BUILD)
set(ICU_FOUND 1)
else() # NOT SW_BUILD
Expand Down Expand Up @@ -326,7 +322,7 @@ if(ICU_FOUND)
# ############################################################################

add_executable(lstmeval lstmeval.cpp)
target_link_libraries(lstmeval unicharset_training ${LIB_pthread})
target_link_libraries(lstmeval unicharset_training)
project_group(lstmeval "Training Tools")
install(
TARGETS lstmeval
Expand All @@ -342,7 +338,7 @@ if(ICU_FOUND)
# ############################################################################

add_executable(lstmtraining lstmtraining.cpp)
target_link_libraries(lstmtraining unicharset_training ${LIB_pthread})
target_link_libraries(lstmtraining unicharset_training)
project_group(lstmtraining "Training Tools")
install(
TARGETS lstmtraining
Expand Down