CMake compare_files sorted -
in workflow generated files stored source code support ancient build system (which can't fixed , won't go away because reasons).
so, cmake build uses cmake -e compare_files ...
check wsdl gives same *.h , *.cpp files.
kdsoap kdwsdl2cpp
generator not producing stable output: order of classes can different invocation invocation.
that breaks check. 1 option sort lines of files before comparison. there portable way that?
you can write cmake script that:
# input variables: file1 , file2. # returns 0 if files same after sort. cmake_policy(set cmp0007 new) file(strings ${file1} v1) file(strings ${file2} v2) list(sort v1) list(sort v2) if(not v1 strequal v2) message( fatal_error "files '${file1}' , '${file2}' not equal." ) endif(not v1 strequal v2)
and use command
in add_custom_target
:
command ${cmake_command} -dfile1=${cmake_current_source_dir}/foo.cpp -dfile2=${cmake_current_binary_dir}/foo_generated.cpp -p ${cmake_current_source_dir}/sortcomparefiles.cmake
Comments
Post a Comment