为什么我必须设置
set(CAPNP_LIB_CAPNP-JSON "")
在我的 CMakeLists.txt 中为了不出错?错误如下:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CAPNP_LIB_CAPNP-JSON (ADVANCED)
linked by target "client" in directory <...>
linked by target "server" in directory <...>
我使用 capnproto CMake 支持的方式是将capnproto 源中包含的 cmake 文件复制到我的项目中并手动包含它。(有没有更好/标准的方法来做到这一点?感觉很hackish。)其余的只是取自CMake文件的说明。
CMake 片段:
# so capnp cmake plugin is found
set(CapnProto_DIR "${CMAKE_CURRENT_SOURCE_DIR}/etc/cmake")
# for some reason there is some json lib or something that isn't found?
#set(CAPNP_LIB_CAPNP-JSON "")
find_package(CapnProto REQUIRED)
include_directories(${CAPNP_INCLUDE_DIRS})
add_definitions(${CAPNP_DEFINITIONS})
set(CAPNPC_SRC_PREFIX "src/capnp")
# capnp out of source config
set(CAPNPC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CAPNPC_OUTPUT_DIR})
# gen cpp
capnp_generate_cpp(CAPNP_SRCS CAPNP_HDRS
src/capnp/schema.capnp
)
CMake 3.6.2,使用 CLion 的集成构建命令进行构建。capnp 是通过自制软件安装的,最新版本。
为什么我收到有关 JSON 位的错误?那是关于什么的?
另外,有没有更好的方法来包含官方 Cap'n Proto CMake 文件?通过自制软件安装时,它似乎没有随头文件和库文件一起分发。