如何在构建步骤中从对象名称中删除文件扩展名?

How can I remove the file extension from the object name in the build step?

CMAKE_<LANG>_COMPILE_OBJECT是设置编译规则的变量。

set("<CMAKE_MY_COMPILER> <DEFINES> <INCLUDES> -o <OBJECT> -c <FLAGS> <SOURCE>")

这个变量在CMake<LANG>Information.cmake中设置。源文件已构建并生成目标文件 build/hello_world.o。 CMake 期望编译器生成不同的对象名称。

[ 95%] Building object CMakeFiles/hello_world.dir/src/hello_world.my.o
[100%] Linking executable hello_world
[100%] Built target hello_world

如何在构建步骤中从对象名称中删除源文件扩展名 my

设置以下变量:

set(CMAKE_<LANG>_OUTPUT_EXTENSION_REPLACE 1)

我在文件 CMakeLANGInformation.cmake 中为新的 cmake 语言设置了这个。