mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 12:49:35 +08:00
Modernize CMake config files
This commit is contained in:
parent
bd6c2e5b03
commit
c8a164b1fb
@ -370,12 +370,17 @@ configure_file(
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/vs2010/tesseract/libtesseract.rc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/vs2010/tesseract/libtesseract.rc @ONLY)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/TesseractConfig-version.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake/TesseractConfig-version.cmake @ONLY)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/TesseractConfig.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake/TesseractConfig.cmake @ONLY)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
configure_package_config_file(
|
||||
cmake/templates/TesseractConfig.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake/TesseractConfig.cmake
|
||||
INSTALL_DESTINATION lib/tesseract/cmake
|
||||
PATH_VARS INCLUDE_DIR)
|
||||
write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake/TesseractConfigVersion.cmake
|
||||
VERSION ${PACKAGE_VERSION}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
# show summary of configuration
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||
|
@ -1,14 +0,0 @@
|
||||
set(Tesseract_VERSION @VERSION_PLAIN@)
|
||||
set(PACKAGE_VERSION ${Tesseract_VERSION})
|
||||
|
||||
set(PACKAGE_VERSION_EXACT False)
|
||||
set(PACKAGE_VERSION_COMPATIBLE False)
|
||||
|
||||
if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT True)
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
endif()
|
@ -7,15 +7,11 @@
|
||||
# In your CMakeLists.txt, add these lines:
|
||||
#
|
||||
# find_package(Tesseract REQUIRED)
|
||||
# include_directories(${Tesseract_INCLUDE_DIRS})
|
||||
# target_link_libraries(MY_TARGET_NAME ${Tesseract_LIBRARIES})
|
||||
# target_link_libraries(MY_TARGET_NAME Tesseract::Tesseract)
|
||||
#
|
||||
# This file will define the following variables:
|
||||
# - Tesseract_LIBRARIES : The list of all imported targets for OpenCV modules.
|
||||
# - Tesseract_INCLUDE_DIRS : The Tesseract include directories.
|
||||
# - Tesseract_VERSION : The version of this Tesseract build: "@VERSION_PLAIN@"
|
||||
# - Tesseract_VERSION_MAJOR : Major version part of Tesseract_VERSION: "@VERSION_MAJOR@"
|
||||
# - Tesseract_VERSION_MINOR : Minor version part of Tesseract_VERSION: "@VERSION_MINOR@"
|
||||
#
|
||||
# ===================================================================================
|
||||
|
||||
@ -23,23 +19,17 @@ include(${CMAKE_CURRENT_LIST_DIR}/TesseractTargets.cmake)
|
||||
|
||||
find_package(Leptonica REQUIRED)
|
||||
|
||||
# ======================================================
|
||||
# Version variables:
|
||||
# ======================================================
|
||||
|
||||
SET(Tesseract_VERSION @VERSION_PLAIN@)
|
||||
SET(Tesseract_VERSION_MAJOR @VERSION_MAJOR@)
|
||||
SET(Tesseract_VERSION_MINOR @VERSION_MINOR@)
|
||||
|
||||
# ======================================================
|
||||
# Include directories to add to the user project:
|
||||
# ======================================================
|
||||
|
||||
# Provide the include directories to the caller
|
||||
set(Tesseract_INCLUDE_DIRS @INCLUDE_DIR@)
|
||||
|
||||
# ====================================================================
|
||||
# Link libraries:
|
||||
# ====================================================================
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(Tesseract_INCLUDE_DIR "@PACKAGE_INCLUDE_DIR@")
|
||||
set(Tesseract_LIBRARIES libtesseract)
|
||||
|
||||
if(Tesseract_FOUND AND NOT TARGET Tesseract::Tesseract)
|
||||
add_library(Tesseract::Tesseract UNKNOWN IMPORTED)
|
||||
set_target_properties(Tesseract::Tesseract PROPERTIES
|
||||
IMPORTED_LOCATION ${Tesseract_LIBRARIES}
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Tesseract_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
check_required_components(Tesseract)
|
||||
|
Loading…
Reference in New Issue
Block a user