cmake:您已经为库cryptopp调用了ADD_LIBRARY而没有任何源文件

时间:2016-02-18 11:53:18

标签: c++ windows git cmake

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

我在此帖中修复了上一期:Compile issues: LIBUSB_1 with cmake project on Windows

所以当我点击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错误......

1 个答案:

答案 0 :(得分:2)

基于对项目的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中应该提供丢失的文件。