cmake:您在没有任何源文件的情况下调用了库 cryptopp 的ADD_LIBRARY

cmake: You have called ADD_LIBRARY for library cryptopp without any source files

本文关键字:调用 cryptopp ADD LIBRARY 情况下 cmake 源文件 任何      更新时间:2023-10-16

Windows 64bit 使用 cmake 编译 c++ 项目: github.com/iHateInventNames/synergy-through-usb

我在这篇文章中修复了一个上一个问题:编译问题:在 Windows 上使用 cmake 项目LIBUSB_1

因此,当我现在点击cmake时,出现以下错误:

> cmake .
-- Found libusb-1.0:
--  - Includes: C:/local/libs/libusbx
--  - Libraries: C:/local/libs/libusbx/libusb-1.0.lib
You have called ADD_LIBRARY for library cryptopp without any source files. This typically indicates a problem with your CMakeLists.txt file
-- Configuring done
CMake Error: CMake can not determine linker language for target: cryptopp
CMake Error: CMake can not determine linker language for target: cryptopp
CMake Error: CMake can not determine linker language for target: cryptopp
CMake Error: CMake can not determine linker language for target: cryptopp
-- Generating done
-- Build files have been written to: C:/local/projects/synergy-usb/synergy-through-usb-master

这是什么意思? 我该如何解决/继续前进?

指向安装说明的链接

两个转到 404 错误...

  • http://synergy-project.org/projects/synergy/wiki/Readme/?hl=pm
  • http://synergy-project.org/projects/synergy/wiki/Compiling/?hl=pm

根据快速浏览项目的 CMakeLists,似乎您应该在运行 CMake 之前tools/cryptopp562.zip解压缩到名为 tools/cryptopp562 的目录中。如果有的话,这绝对应该在项目的安装说明中提到。

更准确地说,文件tools/CMakeLists.txt包含以下代码:

set(cpp_dir cryptopp562)
file(GLOB cpp_src ${cpp_dir}/*.cpp)
# ...
add_library(cryptopp STATIC ${cpp_src})

这意味着变量cpp_src填充了从目录cryptopp562获取的源文件(相对于 CMakeList 的目录,即 tools ),然后用于定义库cryptopp的源文件。但是,该项目的分发仅包含tools/cryptopp562.zip 。将其解压缩到目录中tools/cryptopp562应该提供丢失的文件。