Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何为 cmake 项目设置附加包含(不在 CmakeLists.txt 中)或如何在不覆盖此项目 CMakeLists.txt 的情况下为项目包含附加 *.cmake 文件。
我尝试-DCMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES=<...>and -DCMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES=<...>,但没有效果。
-DCMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES=<...>
-DCMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES=<...>
CMAKE_CXX_FLAGS您可以通过在变量中指定它们并CMAKE_C_FLAGS在调用 cmake 时添加其他包含目录:
CMAKE_CXX_FLAGS
CMAKE_C_FLAGS
cmake -DCMAKE_CXX_FLAGS="-I /path/to/dir" ..