当我尝试使用以下命令包含mongo时
find_package(libmongocxx REQUIRED)
find_package(libbsoncxx REQUIRED)我得到的只有>
This CMake target is deprecated. Use 'mongo::mongocxx_shared' instead.
Consult the example projects for further details.
This CMake target is deprecated. Use 'mongo::bsoncxx_shared' instead.
Consult the example projects for further details.我应该如何正确地包含mongo?我有点迷路了。
注意,我可以包括它,它“工作”,但我想做“适当的”。
发布于 2020-07-16 04:50:09
是的,您正在使用旧的指令。现在你只需要使用下面这样的东西:
cmake_minimum_required(VERSION 3.16)
project(mongo_test)
set(CMAKE_CXX_STANDARD 17)
add_executable(mongo_test main.cpp)
find_package(mongocxx REQUIRED)
find_package(bsoncxx REQUIRED)
include_directories(${LIBMONGOCXX_INCLUDE_DIR})
include_directories(${LIBBSONCXX_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE mongo::bsoncxx_shared)
target_link_libraries(${PROJECT_NAME} PRIVATE mongo::mongocxx_shared)在Fedora 32上工作(gcc 10.1,cmake版本3.16)
https://stackoverflow.com/questions/62160897
复制相似问题