【问题标题】:cmake: You have called ADD_LIBRARY for library cryptopp without any source filescmake:您为库 cryptopp 调用了 ADD_LIBRARY,但没有任何源文件
【发布时间】:2016-02-18 11:53:18
【问题描述】:

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 错误...

【问题讨论】:

  • 您是否遵循安装说明(如果有)?根据对项目 CMakeLists 的快速浏览,您似乎应该在运行 CMake 之前将 tools/cryptopp562.zip 解压缩到名为 tools/cryptopp562 的目录中。
  • @Angew 我真的会为了安装说明而杀! - 我已将链接添加到说明页面,但它们都出现错误 404 :( 感谢您的洞察力,但我没有发现有要提取的 zio 文件......我会试一试 - 如果有效,我会让你知道,你可以把它作为答案:)
  • @Angew,这行得通:),最后这是一个非常简单的问题,谢谢。如果您将评论添加为答案,我会标记它。
  • 我认为协同公司删除构建指令违反了 GPL。有人有兴趣 fork 一个可编译的版本吗?

标签: c++ windows git cmake


【解决方案1】:

根据快速浏览项目的 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 应该会提供丢失的文件。

【讨论】:

    猜你喜欢
    • 2011-03-28
    • 2013-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多