diff --git a/CMakeLists.txt b/CMakeLists.txt index d1b5e5a..5d20e57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,13 +170,11 @@ endif() if (HEXL_DEBUG) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/third-party/easylogging") - find_package(EASYLOGGINGPP MODULE) + include(FindPkgConfig) + pkg_search_module("EASYLOGGINGPP" REQUIRED IMPORTED_TARGET "easyloggingpp") if (EASYLOGGINGPP_FOUND) message(STATUS "easyloggingpp: pre-installed easyloggingpp found") - get_target_property( - EASYLOGGINGPP_INCLUDE_DIR - easyloggingpp - INTERFACE_INCLUDE_DIRECTORIES) + set(easylogging "PkgConfig::EASYLOGGINGPP") else() message(STATUS "easyloggingpp: pre-installed easyloggingpp NOT found, building from source") add_subdirectory(cmake/third-party/easylogging) diff --git a/hexl/CMakeLists.txt b/hexl/CMakeLists.txt index e9fc5ba..07cb064 100644 --- a/hexl/CMakeLists.txt +++ b/hexl/CMakeLists.txt @@ -122,11 +122,7 @@ install(DIRECTORY ${HEXL_INC_ROOT_DIR}/ if (HEXL_SHARED_LIB) target_link_libraries(hexl PRIVATE cpu_features) if (HEXL_DEBUG) - target_link_libraries(hexl PUBLIC easyloggingpp) - # Manually add logging include directory - target_include_directories(hexl - PUBLIC $> - ) + target_link_libraries(hexl PUBLIC PkgConfig::EASYLOGGINGPP) endif() else () # For static library, if the dependencies are not found on the system, @@ -134,12 +130,8 @@ else () # Export logging only if in debug mode if (HEXL_DEBUG) - # Manually add logging include directory - target_include_directories(hexl - PUBLIC $> - ) if (EASYLOGGINGPP_FOUND) - target_link_libraries(hexl PRIVATE easyloggingpp) + target_link_libraries(hexl PRIVATE PkgConfig::EASYLOGGINGPP) else() hexl_create_archive(hexl easyloggingpp) endif()