在 Unix Makefile 中,我可以在配方行前面加上前缀-以忽略将发生的任何错误(如配方中的错误中所述)。
hello_world: hello_world.cxx
-$(CXX) $(CXXFLAGS) $^ -o $@
我将我的 Makefile 转换为 CMake:
cmake_minimum_required(VERSION 3.0)
project(HelloWorld)
add_executable(hello_world hello_world.cxx)
并运行cmake,生成的 Makefile 看起来很好,除了缺少的-.
是否可以使用 CMake 生成忽略错误的 Unix Makefile(在配方行前加上-)?最好的办法是按目标级别指定它。我知道我可以运行make -i以具有相同的行为,但这并不方便。