File: check_tree.cmake.in

package info (click to toggle)
kf6-extra-cmake-modules 6.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,608 kB
  • sloc: python: 668; cpp: 330; ansic: 291; xml: 182; sh: 62; makefile: 8
file content (20 lines) | stat: -rw-r--r-- 798 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
set(EXPECTED "@CMAKE_CURRENT_SOURCE_DIR@/expected")
set(ACTUAL "@CMAKE_INSTALL_PREFIX@")

# Compares files in two directories, emits a fatal error if the top level files are different
# Takes a directory of expected files, and a directory of output files
function(compare_dirs expected output )
    file(GLOB files "${expected}/*")
    foreach(file ${files})
        get_filename_component(name ${file} NAME)

        execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files ${file} "${output}/${name}"
                                        RESULT_VARIABLE test_result
        )
        If (NOT test_result EQUAL 0)
            message(FATAL_ERROR "Test failed: ${file} doesn't match ${output}/${name}!")
        endif()
    endforeach()
endfunction()

compare_dirs(${EXPECTED} ${ACTUAL}/test )