<commit_before>find_package(PkgConfig REQUIRED)

add_library( blockvault_client_plugin
             blockvault_client_plugin.cpp)
target_link_libraries( blockvault_client_plugin appbase eosio_chain)
target_include_directories( blockvault_client_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" )


if (APPLE AND EXISTS "/usr/local/opt/libpq/lib/pkgconfig")
   # to find libpq installed by homebrew, it is required to set the environment variable PKG_CONFIG_PATH
   if (DEFINED ENV{PKG_CONFIG_PATH})
      set(ENV{PKG_CONFIG_PATH} "/usr/local/opt/libpq/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
   else()
      set(ENV{PKG_CONFIG_PATH} "/usr/local/opt/libpq/lib/pkgconfig")
   endif()
endif()

pkg_check_modules(pq IMPORTED_TARGET  libpq>=10.0)
pkg_check_modules(pqxx IMPORTED_TARGET libpqxx>=6.0)

if (pqxx_FOUND)

   if (APPLE)
      ###################################################################################################
      # Linking libpqxx from homebrew statically could generate `different visibility settings` warnings.
      # As a result, we'll just use link it dynamically for now. 
      ##################################################################################################
      set(pqxx_lib PkgConfig::pqxx PkgConfig::pq)
   else()
      add_library(pqxx STATIC IMPORTED)
      set_property(TARGET pqxx PROPERTY IMPORTED_LOCATION ${pqxx_LIBDIR}/libpqxx.a)
      target_include_directories(pqxx INTERFACE ${pqxx_STATIC_INCLUDE_DIRS})
      target_link_libraries(pqxx INTERFACE PkgConfig::pq)
      set(pqxx_lib pqxx)
   endif()

   add_library(blockvault postgres_backend.cpp)
   target_include_directories(blockvault PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
   target_link_libraries(blockvault PUBLIC ${pqxx_lib} eosio_chain)

   target_link_libraries( blockvault_client_plugin blockvault)
   target_compile_definitions(blockvault_client_plugin PRIVATE HAS_PQXX)

   add_subdirectory(tests)
else()
   message(WARNING "libpqxx is not found, blockvault_client_plugin will not be functional for the lack of available backend")
endif()<commit_msg>cmake imported target pqxx is not correctlly decleared. So, using cmake 3.10 can't pass build. After this change, using cmake 3.10 passed build. see also here: https://cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html It is not possible to use an IMPORTED target in the left-hand-side of the target_compile_definitions(), target_include_directories(), target_compile_options() or target_link_libraries() commands, as that would be an attempt to modify it. IMPORTED targets are designed to be used only in the right-hand-side of those commands.<commit_after>find_package(PkgConfig REQUIRED)

add_library( blockvault_client_plugin
             blockvault_client_plugin.cpp)
target_link_libraries( blockvault_client_plugin appbase eosio_chain)
target_include_directories( blockvault_client_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" )


if (APPLE AND EXISTS "/usr/local/opt/libpq/lib/pkgconfig")
   # to find libpq installed by homebrew, it is required to set the environment variable PKG_CONFIG_PATH
   if (DEFINED ENV{PKG_CONFIG_PATH})
      set(ENV{PKG_CONFIG_PATH} "/usr/local/opt/libpq/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
   else()
      set(ENV{PKG_CONFIG_PATH} "/usr/local/opt/libpq/lib/pkgconfig")
   endif()
endif()

pkg_check_modules(pq IMPORTED_TARGET  libpq>=10.0)
pkg_check_modules(pqxx IMPORTED_TARGET libpqxx>=6.0)

if (pqxx_FOUND)

   if (APPLE)
      ###################################################################################################
      # Linking libpqxx from homebrew statically could generate `different visibility settings` warnings.
      # As a result, we'll just use link it dynamically for now. 
      ##################################################################################################
      set(pqxx_lib PkgConfig::pqxx )
   else()
      add_library(pqxx STATIC IMPORTED)
      set_property(TARGET pqxx PROPERTY IMPORTED_LOCATION ${pqxx_LIBDIR}/libpqxx.a)
      set_property(TARGET pqxx PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${pqxx_STATIC_INCLUDE_DIRS})
      set(pqxx_lib pqxx)
   endif()

   add_library(blockvault postgres_backend.cpp)
   target_include_directories(blockvault PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
   target_link_libraries(blockvault PUBLIC ${pqxx_lib} PkgConfig::pq eosio_chain)

   target_link_libraries( blockvault_client_plugin blockvault)
   target_compile_definitions(blockvault_client_plugin PRIVATE HAS_PQXX)

   add_subdirectory(tests)
else()
   message(WARNING "libpqxx is not found, blockvault_client_plugin will not be functional for the lack of available backend")
endif()
{'fraction_non_alphanumeric': 0.15557457735929808, 'fraction_numerical': 0.004065910549967901, 'mean_word_length': 5.783744557329463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4931704', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1413, 'n_words': 327}