From cb5992f24450599f0e6b48561224416a677f13c8 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 12 Sep 2022 09:10:56 +0200 Subject: [PATCH] Fix #8186: AVCodec split version defines in two files... --- CMakeLists.txt | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15e679930..b4d56439f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(CMAKE_C_EXTENSIONS ON) include(CheckIPOSupported) check_ipo_supported(RESULT supported OUTPUT error) if (supported) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) endif() if(NOT DEFINED VENDOR) @@ -756,18 +756,23 @@ if (WITH_DSP_FFMPEG) # Deactivate FFmpeg backend for sound, if the version is too old. # See libfreerdp/codec/dsp_ffmpeg.h file(STRINGS "${AVCODEC_INCLUDE_DIR}/libavcodec/version.h" AV_VERSION_FILE REGEX "LIBAVCODEC_VERSION_M[A-Z]+[\t ]*[0-9]+") + if (EXISTS "${AVCODEC_INCLUDE_DIR}/libavcodec/version_major.h") + file(STRINGS "${AVCODEC_INCLUDE_DIR}/libavcodec/version_major.h" AV_VERSION_FILE2 REGEX "LIBAVCODEC_VERSION_M[A-Z]+[\t ]*[0-9]+") + list(APPEND AV_VERSION_FILE ${AV_VERSION_FILE2}) + endif() + FOREACH(item ${AV_VERSION_FILE}) STRING(REGEX MATCH "LIBAVCODEC_VERSION_M[A-Z]+[\t ]*[0-9]+" litem ${item}) - IF(litem) - string(REGEX REPLACE "[ \t]+" ";" VSPLIT_LINE ${litem}) - list(LENGTH VSPLIT_LINE VSPLIT_LINE_LEN) - if (NOT "${VSPLIT_LINE_LEN}" EQUAL "2") - message(ERROR "invalid entry in libavcodec version header ${item}") - endif(NOT "${VSPLIT_LINE_LEN}" EQUAL "2") - list(GET VSPLIT_LINE 0 VNAME) - list(GET VSPLIT_LINE 1 VVALUE) - set(${VNAME} ${VVALUE}) - ENDIF(litem) + IF(litem) + string(REGEX REPLACE "[ \t]+" ";" VSPLIT_LINE ${litem}) + list(LENGTH VSPLIT_LINE VSPLIT_LINE_LEN) + if (NOT "${VSPLIT_LINE_LEN}" EQUAL "2") + message(ERROR "invalid entry in libavcodec version header ${item}") + endif(NOT "${VSPLIT_LINE_LEN}" EQUAL "2") + list(GET VSPLIT_LINE 0 VNAME) + list(GET VSPLIT_LINE 1 VVALUE) + set(${VNAME} ${VVALUE}) + ENDIF(litem) ENDFOREACH(item ${AV_VERSION_FILE}) set(AVCODEC_VERSION "${LIBAVCODEC_VERSION_MAJOR}.${LIBAVCODEC_VERSION_MINOR}.${LIBAVCODEC_VERSION_MICRO}") @@ -965,9 +970,9 @@ endif() set(FREERDP_BUILD_CONFIG_LIST "") GET_CMAKE_PROPERTY(res VARIABLES) FOREACH(var ${res}) - IF (var MATCHES "^WITH_*|^BUILD_TESTING|^HAVE_*") - LIST(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}") - ENDIF() + IF (var MATCHES "^WITH_*|^BUILD_TESTING|^HAVE_*") + LIST(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}") + ENDIF() ENDFOREACH() string(REPLACE ";" " " FREERDP_BUILD_CONFIG "${FREERDP_BUILD_CONFIG_LIST}")