如何从 cmake `file(GLOB ... )` 模式中排除单个文件? [英] How do I exclude a single file from a cmake `file(GLOB ... )` pattern?
本文介绍了如何从 cmake `file(GLOB ... )` 模式中排除单个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的 CMakeLists.txt
包含这一行:
file(GLOB lib_srcs Half/half.cpp Iex/*.cpp IlmThread/*.cpp Imath/*.cpp IlmImf/*.cpp)
和 IlmImf
文件夹包含 b44ExpLogTable.cpp
,我需要从构建中排除.
and the IlmImf
folder contains b44ExpLogTable.cpp
, which I need to exclude from the build.
如何实现?
推荐答案
您可以使用 list
函数来操作列表,例如:
You can use the list
function to manipulate the list, for example:
list(REMOVE_ITEM <list> <value> [<value> ...])
在你的情况下,也许这样的事情会奏效:
In your case, maybe something like this will work:
list(REMOVE_ITEM lib_srcs "IlmImf/b44ExpLogTable.cpp")
这篇关于如何从 cmake `file(GLOB ... )` 模式中排除单个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文