mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-23 18:49:08 +08:00
Generate imported target automatically
This commit is contained in:
parent
c8a164b1fb
commit
a0f43ca03c
@ -657,13 +657,13 @@ if (SW_BUILD)
|
||||
org.sw.demo.libarchive.libarchive
|
||||
)
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake "include(${CMAKE_CURRENT_BINARY_DIR}/cppan.cmake)\n")
|
||||
export(TARGETS libtesseract APPEND FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake)
|
||||
export(TARGETS libtesseract APPEND FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake NAMESPACE Tesseract::)
|
||||
else()
|
||||
target_link_libraries (libtesseract PUBLIC
|
||||
${Leptonica_LIBRARIES}
|
||||
${LibArchive_LIBRARIES}
|
||||
)
|
||||
export(TARGETS libtesseract FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake)
|
||||
export(TARGETS libtesseract FILE ${CMAKE_CURRENT_BINARY_DIR}/TesseractTargets.cmake NAMESPACE Tesseract::)
|
||||
endif()
|
||||
|
||||
if (WIN32 AND CLANG AND OPENMP_BUILD)
|
||||
@ -708,7 +708,7 @@ configure_file(tesseract.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/tesseract.pc @ONLY
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tesseract.pc DESTINATION lib/pkgconfig)
|
||||
install(TARGETS tesseract RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(TARGETS libtesseract EXPORT TesseractTargets RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||||
install(EXPORT TesseractTargets DESTINATION lib/tesseract)
|
||||
install(EXPORT TesseractTargets NAMESPACE Tesseract:: DESTINATION lib/cmake/tesseract)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake DESTINATION lib)
|
||||
|
||||
install(FILES
|
||||
|
@ -7,7 +7,7 @@
|
||||
# In your CMakeLists.txt, add these lines:
|
||||
#
|
||||
# find_package(Tesseract REQUIRED)
|
||||
# target_link_libraries(MY_TARGET_NAME Tesseract::Tesseract)
|
||||
# target_link_libraries(MY_TARGET_NAME Tesseract::libtesseract)
|
||||
#
|
||||
# This file will define the following variables:
|
||||
# - Tesseract_LIBRARIES : The list of all imported targets for OpenCV modules.
|
||||
@ -24,12 +24,4 @@ find_package(Leptonica REQUIRED)
|
||||
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