libpqxx: Can't compile in Centos7 environment
I am not a native specker, Please forgive me。 I want to add libpqxx as a third part dependence by CMake。but when i use “cmake …” to compile, there are something wrong like this:

here is my project structure:

and here is my CMakeLists.txt:
cmake_minimum_required (VERSION 3.8)
project ("CMPlatformServer" LANGUAGES CXX)
include_directories(
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/server
${PROJECT_SOURCE_DIR}/third/workflow/_include/
${PROJECT_SOURCE_DIR}/third/libpqxx/include/
)
file(GLOB_RECURSE CODE_SRC "${PROJECT_SOURCE_DIR}/src/*.h"
"${PROJECT_SOURCE_DIR}/src/*.cpp"
"${PROJECT_SOURCE_DIR}/src/server/*.h"
"${PROJECT_SOURCE_DIR}/src/server/*.cpp")
add_subdirectory(${PROJECT_SOURCE_DIR}/third/workflow)
add_subdirectory(${PROJECT_SOURCE_DIR}/third/libpqxx)
add_executable (CMPlatformServer ${CODE_SRC})
set(LIBPQXX_TARGET_DIRS ${PROJECT_SOURCE_DIR}/third/libpqxx/include/pqxx/)
set(LIBPQXX_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/third/libpqxx/include/)
target_link_libraries(CMPlatformServer
PRIVATE workflow-static pthread ssl crypto
PUBLIC ${LIBPQXX_TARGET_DIRS}
)
target_include_directories(CMPlatformServer ${LIBPQXX_INCLUDE_DIRS})
how can i currently import libpqxx by CMake?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 20 (9 by maintainers)
Thanks @tt4g & @KayEss - I had nothing to contribute to this one!
I turn to version7.6 and switch c++ compile version to C++17. and finally success! 🎉🎉 I guess libpqxx 6.x may has some problem when compiling. my CMakeLists.txt don’t amend anything, that prove it is works
thank you so much to help me solve problems 😘😘