3. CMake 经验技巧¶
3.2. CMAKE_TOOLCHAIN_FILE was not used by the project¶
用 CMake 构建工程文件时,会出现如下警告信息:
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_TOOLCHAIN_FILE
This is the standard warning gives you when you’re giving it a command line option it’s not using. That is giving -DFOO=bar to cmake when the CMakeLists.txt doesn’t use FOO variable.
Now, that’s a bit of a special case here: CMAKE_TOOLCHAIN_FILE is used by CMake the first time you’re configuring your build, but as you can’t change the toolchain for an already configured build, it’s ignored every other time, thus the warning.