我们的项目中有一个树形目录结构,如:
project_dir/public_include
public_include has dir1, dir2 and dir3
现在,我想根据选项
包含目录if(option A)
include_directories(project_dir/public_include/dir1)
else
include_directories(project_dir/public_include/dir3
project_dir/public_include/dir2)
endif()
头文件是独立的。
它无法正常工作!我错过了什么吗?
答案 0 :(得分:0)
options
怎么样?尝试使用option(option_A "include dir 1" ON)
顶部的CMakeLists.txt
。默认设置为option_A=ON
,您的if
语句应该有效。