I'm trying to include libpqxx to my project. For this I build it with configure script as it said here.
After install I have .a file in /user/local/lib and headers in /usr/local/include/pqxx
I have this in my CmakeLists.txt:
target_include_directories("${PROJECT_NAME}" PUBLIC /usr/local/include)
target_link_libraries("${PROJECT_NAME}" PRIVATE ${PROJECT_NAME} pqxx)
This is in my main.cpp: #include <pqxx/pqxx>
When I launch in the build folder
cmake ..
cmake --build ./
I get many errors like this:
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::column_number(pqxx::zview) const':
/home/armhf/myuser/libpq/src/result.cxx:401: undefined reference to `PQfnumber'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::table_column(int) const':
/home/armhf/myuser/libpq/src/result.cxx:429: undefined reference to `PQftablecol'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::columns() const':
/home/armhf/myuser/libpq/src/result.cxx:485: undefined reference to `PQnfields'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::internal::clear_result(pg_result const*)':
I don't even have /home/armhf/myuser/libpq
folder and cmake shows me errors in files there. I don't understand what is wrong.