如何将 CMake 目标文件后缀从默认的 '.o' 更改
为了配置 CMake 使用替代的目标文件后缀(默认:Linux 上为 .o),在你的 CMakeLists.txt 中使用这些行:
CMakeLists.txt
set(CMAKE_C_OUTPUT_EXTENSION ".rel")
set(CMAKE_CXX_OUTPUT_EXTENSION ".rel")此示例将输出扩展名从 .o 更改为 .rel(SDCC 编译器需要)。确保将 ".rel" 替换为你想要的输出后缀。
注意为了使这些生效,你可能需要完全删除 CMakeCache.txt、CMakeFiles 和 cmake_install.cmake:
cleanup_cmake_cache.sh
rm -rf CMakeCache.txt CMakeFiles cmake_install.cmakeIf this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow