From e416e15155c347dc68ea233202763766b556c94b Mon Sep 17 00:00:00 2001 From: Huang-Ming Huang Date: Wed, 9 Dec 2020 13:42:16 -0600 Subject: [PATCH 1/2] FIX libpqxx not found problem --- plugins/blockvault_client_plugin/CMakeLists.txt | 2 +- plugins/resource_monitor_plugin/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/blockvault_client_plugin/CMakeLists.txt b/plugins/blockvault_client_plugin/CMakeLists.txt index 1f1a0e2be9f..98d7769c9b9 100644 --- a/plugins/blockvault_client_plugin/CMakeLists.txt +++ b/plugins/blockvault_client_plugin/CMakeLists.txt @@ -21,7 +21,7 @@ pkg_check_modules(pqxx IMPORTED_TARGET libpqxx>=6.0) if (pqxx_FOUND) add_library(blockvault postgres_backend.cpp) target_include_directories(blockvault PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${pqxx_STATIC_INCLUDE_DIRS}) + PUBLIC ${pqxx_STATIC_INCLUDE_DIRS}) target_link_libraries(blockvault PUBLIC libpqxx.a PkgConfig::pq eosio_chain) target_link_directories(blockvault PUBLIC ${pqxx_STATIC_LIBRARY_DIRS}) diff --git a/plugins/resource_monitor_plugin/CMakeLists.txt b/plugins/resource_monitor_plugin/CMakeLists.txt index fff4bb30ae7..203810d0d66 100644 --- a/plugins/resource_monitor_plugin/CMakeLists.txt +++ b/plugins/resource_monitor_plugin/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( resource_monitor_plugin system_file_space_provider.cpp ${HEADERS} ) -target_link_libraries( resource_monitor_plugin appbase fc chain_plugin) +target_link_libraries( resource_monitor_plugin appbase fc chain_plugin blockvault_client_plugin) target_include_directories( resource_monitor_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) add_subdirectory( test ) From 893405718a1154c1c9333d9abb492a319851bb8e Mon Sep 17 00:00:00 2001 From: Huang-Ming Huang Date: Wed, 9 Dec 2020 15:05:42 -0600 Subject: [PATCH 2/2] Use import target for libpqxx --- plugins/blockvault_client_plugin/CMakeLists.txt | 13 ++++++++----- plugins/resource_monitor_plugin/CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/blockvault_client_plugin/CMakeLists.txt b/plugins/blockvault_client_plugin/CMakeLists.txt index 98d7769c9b9..b95a5cbe8d0 100644 --- a/plugins/blockvault_client_plugin/CMakeLists.txt +++ b/plugins/blockvault_client_plugin/CMakeLists.txt @@ -19,12 +19,15 @@ pkg_check_modules(pq IMPORTED_TARGET libpq>=10.0) pkg_check_modules(pqxx IMPORTED_TARGET libpqxx>=6.0) if (pqxx_FOUND) - add_library(blockvault postgres_backend.cpp) - target_include_directories(blockvault PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include - PUBLIC ${pqxx_STATIC_INCLUDE_DIRS}) - target_link_libraries(blockvault PUBLIC libpqxx.a PkgConfig::pq eosio_chain) - target_link_directories(blockvault PUBLIC ${pqxx_STATIC_LIBRARY_DIRS}) + add_library(pqxx STATIC IMPORTED) + set_property(TARGET pqxx PROPERTY IMPORTED_LOCATION ${pqxx_STATIC_LIBRARY_DIRS}/libpqxx.a) + target_include_directories(pqxx INTERFACE ${pqxx_STATIC_INCLUDE_DIRS}) + target_link_libraries(pqxx INTERFACE PkgConfig::pq) + + add_library(blockvault postgres_backend.cpp) + target_include_directories(blockvault PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) + target_link_libraries(blockvault PUBLIC pqxx eosio_chain) target_link_libraries( blockvault_client_plugin blockvault) target_compile_definitions(blockvault_client_plugin PRIVATE HAS_PQXX) diff --git a/plugins/resource_monitor_plugin/CMakeLists.txt b/plugins/resource_monitor_plugin/CMakeLists.txt index 203810d0d66..fff4bb30ae7 100644 --- a/plugins/resource_monitor_plugin/CMakeLists.txt +++ b/plugins/resource_monitor_plugin/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( resource_monitor_plugin system_file_space_provider.cpp ${HEADERS} ) -target_link_libraries( resource_monitor_plugin appbase fc chain_plugin blockvault_client_plugin) +target_link_libraries( resource_monitor_plugin appbase fc chain_plugin) target_include_directories( resource_monitor_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) add_subdirectory( test )