Added fallback for incomplete Poco distributions.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
tastytea 2019-08-06 17:35:12 +02:00
parent e6b0463e59
commit 9c925e855d
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07

View File

@ -13,7 +13,27 @@ target_include_directories(${PROJECT_NAME}-cli
PRIVATE "${PROJECT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(${PROJECT_NAME}-cli
PRIVATE ${PROJECT_NAME} Poco::Util)
PRIVATE ${PROJECT_NAME})
# If no Poco*Config.cmake recipes are found, look for headers in standard dirs.
if(PocoUtil_FOUND)
target_link_libraries(${PROJECT_NAME}-cli
PRIVATE Poco::Util)
else()
find_file(Poco_h NAMES "Poco/Poco.h"
PATHS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
if("${Poco_h}" STREQUAL "Poco_h-NOTFOUND")
message(FATAL_ERROR "Could not find POCO.")
else()
message(WARNING
"Your distribution of POCO doesn't contain the *Config.cmake recipes, "
"but the files seem to be in the standard directories. "
"Let's hope this works.")
target_link_libraries(${PROJECT_NAME}-cli
PRIVATE PocoUtil)
endif()
endif()
install(TARGETS ${PROJECT_NAME}-cli
DESTINATION ${CMAKE_INSTALL_BINDIR})