You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've just started using SOCI for my project and encountered an odd error:
soci/include/soci/postgresql/soci-postgresql.h:22:10: fatal error: 'libpq-fe.h' file not found
[build] #include <libpq-fe.h>
As follows from the error - I am using PostgreSQL. Seems like main header of libpq++ is not included.
I'm going add_subdirectory(...) route in my project (I'm using git-submodules) and building a shared library version of SOCI (SOCI_SHARED set to ON).
Before using SOCI I've read the documentation and checked out the examples. Nothing helped.
Then I've started debugging CMake and figured out something.
In soci/cmake/SociBackend.cmake file:
if (SOCI_SHARED)
add_library(${THIS_BACKEND_TARGET}SHARED${THIS_BACKEND_SOURCES}${THIS_BACKEND_HEADERS})
add_library(Soci::${NAMEL}ALIAS${THIS_BACKEND_TARGET})
target_link_libraries(${THIS_BACKEND_TARGET}${SOCI_CORE_TARGET}${THIS_BACKEND_DEPENDS_LIBRARIES})
...
No include directories are provided for target (soci_postgresql in my case). Considering this - I've added:
I do understand, that I can as well include PostgreSQL's headers directly to my target, but wouldn't it be more convenient to include libpq-fe.h in SOCI (file: SociBackend.cmake), when initializing PostgreSQL's backend, considering it is already successfully locates said headers? Am I missing something?
Sorry, I don't understand how exactly does this differ from building SOCI directly which definitely does work. CMake is not my strong point (and I'm being euphemistic here), so it's quite possible that there is a bug in SOCI CMakefiles but I have no idea why would it happen only when it's included as a subdirectory, would you?
Issue with CMake
Setup:
OS: Ubuntu 22.04.3 LTS
,Compiler: Clang 15.0.7 x86_64
,C++ standard: c++20
,CMake version: 3.28.1
.I've just started using SOCI for my project and encountered an odd error:
As follows from the error - I am using PostgreSQL. Seems like main header of
libpq++
is not included.I'm going
add_subdirectory(...)
route in my project (I'm usinggit-submodules
) and building a shared library version of SOCI (SOCI_SHARED
set toON
).Before using SOCI I've read the documentation and checked out the examples. Nothing helped.
Then I've started debugging CMake and figured out something.
In
soci/cmake/SociBackend.cmake
file:No include directories are provided for target (soci_postgresql in my case). Considering this - I've added:
I do understand, that I can as well include PostgreSQL's headers directly to my target, but wouldn't it be more convenient to include
libpq-fe.h
in SOCI (file:SociBackend.cmake
), when initializing PostgreSQL's backend, considering it is already successfully locates said headers? Am I missing something?For better understanding I've provided a minimal reproduction repository.
Thank you in advance.
The text was updated successfully, but these errors were encountered: