18615

How to compare files in CMake

<h3>Question</h3>

Is there a way to compare files using cmake? I've checked all parameters from https://cmake.org/cmake/help/latest/command/file.html


<h3>Answer1:</h3>

cmake executable has a tool mode, when it performs some useful actions instead of project's configuration. And compare_files is one of the commands for that mode.

For get features of the CMake command line tool mode in the CMakeLists.txt, use execute_process command:

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()

来源:https://stackoverflow.com/questions/54353120/how-to-compare-files-in-cmake

Recommend

  • Azure DocumentDB Owner resource does not exist
  • Bitshift from a specific bit onwards in binary number? [duplicate]
  • ExecutionContext is null to non-function methods via IoC, alternative to ExecutionContext.FunctionAp
  • Bluetooth Low Energy device scanning Failed with an exception
  • my javascript in external html is not loading
  • load ActiveX object in Applet
  • docker + nginx + node.js + php-fpm
  • how to capture key repeats with javascript [duplicate]
  • How can I get a spring JdbcTemplate to read_uncommitted?
  • How to store confidential PDF documents (file system vs. SQL) if we only use forms authentication
  • GWT Simple Drag and Drop for custom widgets
  • Why I receive this error using componentWillReceiveProps?
  • No suggestions when code snippets are used in sublime
  • Nested iframe cross-domain communication
  • How to see if all values within group are unique/identify those that aren't
  • HTTPS request/response in Android
  • Progress bar shadow only on filled part
  • Why use 4096 elements for a char array buffer?
  • How can I use Angular4 *ngFor to create a data table?
  • Two way one to one associations in Ember Data
  • Setup SignalR and Service Bus inside a Azure Service Fabric service
  • Get method parameters with specific annotation in aspect in scala using java reflection
  • Recognize Patterns of images JPG or PNG
  • PushPlugin not found, or is not a CDVPlugin
  • ImportError with importing keras
  • SSRS Subscription to an email group (distribution list) is not working
  • Objects Sorting With date ,Time Problem in Array(Iphone Development)
  • Eclipse ADT Plugin crashed after updating to version 22.0
  • GitLab runner on Windows and dealing with & %ERRORLEVEL%
  • Window-select multiple artists and drag them on canvas
  • How to map a native query to POJO class using jpa and hibernate
  • no endpoints available for service \\“kubernetes-dashboard\\”
  • MySQL - Filter records which date is biggest
  • Planned Contrasts on glmmTMB
  • How to highlighting active menu item on scroll and click?
  • Misplaced CAGradientLayer on iPhone 6s
  • Combine two jagged lists into one
  • Compiling multiple source files in Rcpp
  • trigger ontouch event programmatically
  • How to handle div that is created dynamically in a table