【发布时间】:2017-07-02 16:51:45
【问题描述】:
我正在尝试从使用 CMakeFiles 的现有项目中导入外部项目。为此,我正在尝试添加一个包含导入所需文件的静态库“.a”。
我的 CMakeFiles.txt:
cmake_minimum_required(VERSION 2.8.9)
project(TEST)
set(CMAKE_BUILD_TYPE Release)
#Bring the headers, such as Student.h into the project
include_directories(include)
#但是,文件(GLOB...)允许添加通配符:
file(GLOB SOURCES "src/examples/equality_prob/*.cpp" "src/examples/equality_prob/common/*.cpp")
#Generate the static library from the sources
add_library(testEquality STATIC ${SOURCES})
直到那里我认为我在正确的方式。但是在文件中(GLOB SOURCES,我想添加一个文件夹中的所有文件 *.cpp , *.h 等等,其中包含其他文件夹。
我可以在 Makefiles 中这样做:
$(shell find ${SRC}/examples -type f -name '*.o')
但是我怎样才能在 CMakeFiles 中做到这一点?
【问题讨论】:
-
file(GLOB_RECURSE ...)?