我正在尝试使用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)