小编Arc*_*chy的帖子

CMake和绝对标头路径

我正在尝试使用CMake来构建我的C++项目,我在标题路径中遇到了问题.

由于我在很多目录中使用了很多类,所有我的include语句都是绝对路径(因此不需要使用"../../")但是当尝试制作CMake生成的Makefile时它只是没有不行.

有谁知道如何在CMakeLists.txt中指定所有包含绝对路径?


尝试制作时的输出

~/multiboost/BanditsLS/GenericBanditAlgorithmLS.h:45:25: Utils/Utils.h: No such file or directory
~/multiboost/BanditsLS/GenericBanditAlgorithmLS.h:46:35: Utils/StreamTokenizer.h: No such file or directory

我的CMakeLists.txt文件:

#The following command allows the use of the "file" command
cmake_minimum_required(VERSION 2.6)  

#The declaration of the project
project(multiboost)  

#This allows recursive parsing of the source files
file(
    GLOB_RECURSE
    source_files
    *
    )  
list(REMOVE_ITEM source_files ./build/* )

#This indicates the target (the executable)  
add_executable(
    multiboost
    ${source_files} #EXCLUDE_FROM_ALL build/
    )
Run Code Online (Sandbox Code Playgroud)

c++ header path cmake include

12
推荐指数
2
解决办法
1万
查看次数

标签 统计

c++ ×1

cmake ×1

header ×1

include ×1

path ×1