Files
CMake/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake
Brad King 82c990e9be Tests: Improve RunCMake.GetPrerequisites sample executable selection
Get the runtime dependencies of an executable just built by the
toolchain with which tests are running.  Previously we used the `cmake`
binary itself, but that might have been built for a different ABI than
the tested binutils support.
2022-11-02 13:45:05 -04:00

22 lines
595 B
CMake

include(GetPrerequisites)
function(check_script script)
set(prereqs "")
get_prerequisites(${script} prereqs 1 1 "" "")
if(NOT "${prereqs}" STREQUAL "")
message(FATAL_ERROR "Prerequisites for ${script} not empty")
endif()
endfunction()
# Should not throw any errors
# Regular executable
if(SAMPLE_EXE)
get_prerequisites("${SAMPLE_EXE}" cmake_prereqs 1 1 "" "")
endif()
# Shell script
check_script(${CMAKE_CURRENT_LIST_DIR}/script.sh)
# Batch script
check_script(${CMAKE_CURRENT_LIST_DIR}/script.bat)
# Shell script without extension
check_script(${CMAKE_CURRENT_LIST_DIR}/script)