summaryrefslogtreecommitdiffstats
path: root/Tests/FindVulkan/Test/Run-glslangValidator.cmake
blob: 27fd9503da56ee72d73a00a31573f8491f194678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
cmake_minimum_required(VERSION 3.12)

function(run_glslangValidator exe exe_display)
  execute_process(COMMAND ${exe} --help
    OUTPUT_VARIABLE output
    OUTPUT_STRIP_TRAILING_WHITESPACE
    RESULT_VARIABLE result
    )

  if(NOT result EQUAL 1)
    message(SEND_ERROR "Result of ${exe_display} --help is ${result}, should be 1")
  endif()

  if(NOT output MATCHES "^Usage: glslangValidator")
    message(SEND_ERROR "Output of ${exe_display} --help is \"${output}\", should begin with \"Usage: glslangValidator\"")
  endif()
endfunction()

run_glslangValidator("${VULKAN_GLSLANG_VALIDATOR_EXECUTABLE}" "\${VULKAN_GLSLANG_VALIDATOR_EXECUTABLE}")
run_glslangValidator("${VULKAN_GLSLANG_VALIDATOR_EXECUTABLE_TARGET}" "Vulkan::glslangValidator")