【问题标题】:CMake Error at CMakeLists.txt (add_library): [duplicate]CMakeLists.txt 中的 CMake 错误(add_library):[重复]
【发布时间】:2017-06-07 20:31:36
【问题描述】:

我不想编译外部库:

它适用于源的完整路径,例如:

add_library(timetool   "../src/wnt/foo.cxx"
                       "../../../../include/foo.h"

它不起作用

add_library(timetool   "../src/wnt/*.cxx"
                       "../../../../include/*.h"

我收到错误消息:

CMake Error at CMakeLists.txt:25 (add_library):
Cannot find source file:

../src/*.cxx

Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx

我能做些什么来解决这个问题?

【问题讨论】:

  • @Florian: 谢谢,你走对了“add_library函数中没有通配符”

标签: cmake


【解决方案1】:

这就是解决方案!函数add_library中没有通配符

file(GLOB timetool_SRC   "../src/wnt/*.cxx"
                         "../../../../include/*.h"

add_library(timetool ${timetool_SRC}

【讨论】:

  • 你应该把 add_library(timetool ${timetool_SRC} 改成 add_library(timetool ${timetool_SRC}) 你忘了')'。
猜你喜欢
  • 2020-06-08
  • 1970-01-01
  • 2013-09-10
  • 2020-12-09
  • 2019-05-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多