在cmake中,cmake文件夹和CMakeLists.txt可以位于不同的文件夹中

in cmake, can cmake folder and CMakeLists.txt sit in different folder?

本文关键字:文件夹 cmake 于不同 CMakeLists txt      更新时间:2023-10-16

在cmake中,cmake文件夹和CMakeLists.txt可以坐在不同的文件夹中吗?\

通常,cmake 文件夹和 CmakeLists.txt 位于同一个源根目录中。但是,要为不同的项目重复使用cmake文件夹,是否可以将cmake文件夹放入其他地方?

这是一个好方法和思考吗?

谢谢

我认为这没有任何问题。您只需要知道 ${CMAKE_SOURCE_DIR} 的相对路径或绝对路径,即可在 CMake 文件中使用它。