有没有一种方法可以使用cmake比较文件?我已经检查了https://cmake.org/cmake/help/latest/command/file.html中的所有参数
cmake可执行文件具有工具模式,当它执行一些有用的操作而不是项目的配置时。并且compare_files是该模式的命令之一。
要在中获取CMake命令行工具模式的功能CMakeLists.txt,请使用以下execute_process命令:
execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files <file1> <file2>
RESULT_VARIABLE compare_result
)
if( compare_result EQUAL 0)
message("The files are identical.")
elseif( compare_result EQUAL 1)
message("The files are different.")
else()
message("Error while comparing the files.")
endif()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
422 次 |
| 最近记录: |