Skip to content

Commit

Permalink
cmake: fix curl linking if CURL_LIBRARIES is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed Sep 25, 2021
1 parent da084ea commit c4ad9b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Expand Up @@ -693,7 +693,11 @@ if(LibArchive_FOUND)
target_link_libraries(libtesseract PUBLIC ${LibArchive_LIBRARIES})
endif(LibArchive_FOUND)
if(CURL_FOUND)
target_link_libraries(libtesseract PUBLIC ${CURL_LIBRARIES})
if(NOT "${CURL_LIBRARIES}")

This comment has been minimized.

Copy link
@stweil

stweil Jan 1, 2022

Contributor

@zdenop, I get lots of errors with this code:

CMake Error at CMakeLists.txt:812 (add_executable):
  Target "tesseract" links to target "CURL::libcurl" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
[...]

It looks like in my case the if block is executed instead of the else block.
Could it be that the statement should be if (NOT CURL_LIBRARIES)? That fixes the issue for me.

This comment has been minimized.

Copy link
@zdenop

zdenop Jan 2, 2022

Author Contributor

what version of cmake report this? I have no problem on windows with cmake version 3.21.3. Also macos-10.15-gcc-9-cmake. Ubuntu build action seems to have no libcurl ;-)

target_link_libraries(libtesseract PUBLIC CURL::libcurl)
else()
target_link_libraries(libtesseract PUBLIC ${CURL_LIBRARIES})
endif()
endif(CURL_FOUND)
set_target_properties (libtesseract PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
set_target_properties (libtesseract PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
Expand Down

0 comments on commit c4ad9b7

Please sign in to comment.