From 6012678e983b6eb07553a50deac8b6702cda5401 Mon Sep 17 00:00:00 2001 From: David Hampton Date: Sun, 22 Dec 2024 11:53:58 -0500 Subject: [PATCH] cmake: Notice if the install directory has been deleted. The cmake process for building the MythTV sub-project expects to find FFmpeg executables already in the install directory. It runs one of these programs to determine available features. If the program is no longer present, complain and stop instead of continuing with incomplete information. The results of find_xxx are cached, so if the program has been deleted since the first run, find_xx stills return the location of where it used to be. The new "if" test is executed every time to see if the program is actually still there. --- mythtv/cmake/MythFindPackages.cmake | 39 ++++++++++++++++++----------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/mythtv/cmake/MythFindPackages.cmake b/mythtv/cmake/MythFindPackages.cmake index e27b59a0865..6a5478152eb 100644 --- a/mythtv/cmake/MythFindPackages.cmake +++ b/mythtv/cmake/MythFindPackages.cmake @@ -33,14 +33,18 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux|Windows" AND CMAKE_SYSTEM_PROCESSOR MATCHES find_program(_ffmpeg mythffmpeg) find_library(_avcodec mythavdevice) cmake_path(GET _avcodec PARENT_PATH _avcodec_path) - if(_ffmpeg AND _avcodec) - execute_process( - COMMAND ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${_avcodec_path} - ${_ffmpeg} -decoders - OUTPUT_VARIABLE _output - ERROR_QUIET) - string(FIND ${_output} cuvid CUVID_OFFSET) + if(NOT EXISTS ${_ffmpeg}) + message(FATAL_ERROR "Cannot find our ffmpeg executable at ${_ffmpeg}") endif() + if(NOT EXISTS ${_avcodec}) + message(FATAL_ERROR "Cannot find our mythavdevice library ${_avcodec}") + endif() + execute_process( + COMMAND ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${_avcodec_path} + ${_ffmpeg} -decoders + OUTPUT_VARIABLE _output + ERROR_QUIET) + string(FIND ${_output} cuvid CUVID_OFFSET) if(NOT CUVID_OFFSET EQUAL -1) target_compile_definitions(PkgConfig::FFNVCODEC INTERFACE USING_NVDEC) endif() @@ -513,14 +517,19 @@ if(APPLE) find_program(_ffmpeg mythffmpeg) find_library(_avcodec mythavdevice) cmake_path(GET _avcodec PARENT_PATH _avcodec_path) - if(_ffmpeg AND _avcodec) - execute_process( - COMMAND ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${_avcodec_path} - ${_ffmpeg} -decoders - OUTPUT_VARIABLE _output - ERROR_QUIET) - string(FIND ${_output} videotoolbox VIDEOTOOLBOX_OFFSET) - endif() + if(NOT EXISTS ${_ffmpeg}) + message(FATAL_ERROR "Cannot find our ffmpeg executable at ${_ffmpeg}") + endif() + if(NOT EXISTS ${_avcodec}) + message(FATAL_ERROR "Cannot find our mythavdevice library ${_avcodec}") + endif() + execute_process( + COMMAND ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${_avcodec_path} + ${_ffmpeg} -decoders + OUTPUT_VARIABLE _output + ERROR_QUIET) + message(STATUS "Looking for videotoolbox: ${_output}") + string(FIND ${_output} videotoolbox VIDEOTOOLBOX_OFFSET) if(VIDEOTOOLBOX_OFFSET EQUAL -1) unset(APPLE_VIDEOTOOLBOX_LIBRARY) endif()