Advertisement
AlexNovoross87

LIBPQXX WIN

Nov 16th, 2024
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 3.23 KB | None | 0 0
  1. CMAKELISTS_TXT::-------------------------------------------------------------
  2.  
  3. #vcpkg install fmt:x64-mingw-static
  4. cmake_minimum_required(VERSION 3.30 FATAL_ERROR)
  5. #установка поиска библиотек в share vcpkg
  6. set(CMAKE_PREFIX_PATH  "F:\\COMPILESOFT\\vcpkg\\installed\\x64-mingw-static\\share")
  7. project(vsc7 CXX)
  8. set(CMAKE_CXX_STANDARD 20)
  9.  
  10. #показать пути к vcpkg include библиотекам
  11. include_directories("F:\\COMPILESOFT\\vcpkg\\installed\\x64-mingw-static\\include")
  12. link_directories("F:\\COMPILESOFT\\vcpkg\\installed\\x64-mingw-static\\lib")
  13.  
  14. #установка параметров postgre
  15. set(PostgreSQL_INCLUDE_DIR "F:\\COMPILESOFT\\POSTGRE\\17.0.1\\include")
  16. set(PostgreSQL_LIBRARY_DIR "F:\\COMPILESOFT\\POSTGRE\\17.0.1\\lib")
  17. set(PostgreSQL_ROOT "F:\\COMPILESOFT\\POSTGRE\\17.0.1")
  18. #показать пути к postgre
  19. include_directories("F:\\COMPILESOFT\\POSTGRE\\17.0.1\\include")
  20. link_directories("F:\\COMPILESOFT\\POSTGRE\\17.0.1\\lib")
  21.  
  22. #установка параметров open ssl
  23. set(OPENSSL_INCLUDE_DIR "F:/COMPILESOFT/vcpkg/packages/openssl_x64-mingw-static/include/openssl")
  24. set(OPENSSL_CRYPTO_LIBRARY "F:/COMPILESOFT/vcpkg/packages/openssl_x64-mingw-static/lib/libcrypto.a")
  25. set(OPENSSL_SSL_LIBRARY "F:/COMPILESOFT/vcpkg/packages/openssl_x64-mingw-static/lib/liblibssl.a")
  26. set(OPENSSL_ROOT_DIR "F:/COMPILESOFT/vcpkg/packages/openssl_x64-mingw-static")
  27. #показать пути к openssl
  28. link_directories("F:/COMPILESOFT/vcpkg/packages")
  29. include_directories("F:/COMPILESOFT/vcpkg/packages/openssl_x64-mingw-static/include/openssl")
  30.  
  31. find_package(OpenSSL REQUIRED)
  32. if(OpenSSL_FOUND)
  33.     message(STATUS "------------------>>>>> OpenSSL found: ${OpenSSL_VERSION}")
  34.     message(STATUS "------------------>>>>> OpenSSL found: ${OpenSSL_ROOT}")
  35. else()
  36.     message(FATAL_ERROR "OpenSSL not found")
  37. endif()
  38.  
  39. find_package(libpqxx REQUIRED)
  40. if(libpqxx_FOUND)
  41.     message(STATUS "------------------>>>>> libpqxx found: ${libpqxx_VERSION}")
  42.     message(STATUS "------------------>>>>> libpqxx found: ${libpqxx_ROOT}")
  43. else()
  44.     message(FATAL_ERROR "libpqxx not found")
  45. endif()
  46.  
  47. # Вывод информации о найденном пакете
  48. add_executable(exec main.cpp)
  49. target_link_libraries(exec libpqxx::pqxx)
  50.  
  51. ------------------------------------(settings.json in folder .vscode)
  52.  {
  53. "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
  54. "cmake.configureSettings": {
  55.     "CMAKE_TOOLCHAIN_FILE" : "F:/COMPILESOFT/vcpkg/scripts/buildsystems/vcpkg.cmake",}}
  56.  
  57. ------------------------------------(c_cpp_properties.json in folder .vscode)
  58.  
  59. {
  60.     "configurations": [
  61.         {
  62.             "name": "Win32",
  63.             "includePath": [
  64.                 "${workspaceFolder}/**"
  65.             ],
  66.             "defines": [
  67.                 "_DEBUG",
  68.                 "UNICODE",
  69.                 "_UNICODE"
  70.             ],
  71.             "windowsSdkVersion": "10.0.22621.0",
  72.             "compilerPath": "F:/COMPILESOFT/mingw64/bin/g++.exe",
  73.             "cStandard": "c17",
  74.             "cppStandard": "c++20",
  75.             "intelliSenseMode": "windows-gcc-x64",
  76.             "configurationProvider": "ms-vscode.cmake-tools"
  77.         }
  78.     ],
  79.     "version": 4
  80. }
  81.  
  82.  
  83.  
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement