cmake-find-easyloggingpp.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index d1b5e5a..5d20e57 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -170,13 +170,11 @@ endif()
  6. if (HEXL_DEBUG)
  7. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/third-party/easylogging")
  8. - find_package(EASYLOGGINGPP MODULE)
  9. + include(FindPkgConfig)
  10. + pkg_search_module("EASYLOGGINGPP" REQUIRED IMPORTED_TARGET "easyloggingpp")
  11. if (EASYLOGGINGPP_FOUND)
  12. message(STATUS "easyloggingpp: pre-installed easyloggingpp found")
  13. - get_target_property(
  14. - EASYLOGGINGPP_INCLUDE_DIR
  15. - easyloggingpp
  16. - INTERFACE_INCLUDE_DIRECTORIES)
  17. + set(easylogging "PkgConfig::EASYLOGGINGPP")
  18. else()
  19. message(STATUS "easyloggingpp: pre-installed easyloggingpp NOT found, building from source")
  20. add_subdirectory(cmake/third-party/easylogging)
  21. diff --git a/hexl/CMakeLists.txt b/hexl/CMakeLists.txt
  22. index e9fc5ba..07cb064 100644
  23. --- a/hexl/CMakeLists.txt
  24. +++ b/hexl/CMakeLists.txt
  25. @@ -122,11 +122,7 @@ install(DIRECTORY ${HEXL_INC_ROOT_DIR}/
  26. if (HEXL_SHARED_LIB)
  27. target_link_libraries(hexl PRIVATE cpu_features)
  28. if (HEXL_DEBUG)
  29. - target_link_libraries(hexl PUBLIC easyloggingpp)
  30. - # Manually add logging include directory
  31. - target_include_directories(hexl
  32. - PUBLIC $<BUILD_INTERFACE:$<TARGET_PROPERTY:easyloggingpp,INCLUDE_DIRECTORIES>>
  33. - )
  34. + target_link_libraries(hexl PUBLIC PkgConfig::EASYLOGGINGPP)
  35. endif()
  36. else ()
  37. # For static library, if the dependencies are not found on the system,
  38. @@ -134,12 +130,8 @@ else ()
  39. # Export logging only if in debug mode
  40. if (HEXL_DEBUG)
  41. - # Manually add logging include directory
  42. - target_include_directories(hexl
  43. - PUBLIC $<BUILD_INTERFACE:$<TARGET_PROPERTY:easyloggingpp,INCLUDE_DIRECTORIES>>
  44. - )
  45. if (EASYLOGGINGPP_FOUND)
  46. - target_link_libraries(hexl PRIVATE easyloggingpp)
  47. + target_link_libraries(hexl PRIVATE PkgConfig::EASYLOGGINGPP)
  48. else()
  49. hexl_create_archive(hexl easyloggingpp)
  50. endif()