Skip to content

Commit

Permalink
Merge branch 'main' into ffmpeg_linux_static_link
Browse files Browse the repository at this point in the history
  • Loading branch information
tedwaine authored Dec 8, 2023
2 parents 500e7ce + bd12f6c commit e734d17
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmake/modules/FindFFMPEG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,23 @@ function (_ffmpeg_find component headername)
set("FFMPEG_${component}_FOUND" 1
PARENT_SCOPE)

string(TOUPPER "${component}" component_upper)

# Check for `version_major.h`
set(version_major "")
set(version_major_header_path "${FFMPEG_${component}_INCLUDE_DIR}/lib${component}/version_major.h")
if (EXISTS "${version_major_header_path}")
file(STRINGS "${version_major_header_path}" version_major
REGEX "#define *LIB${component_upper}_VERSION_MAJOR ")
endif ()

# Check for `version.h`
set(version_header_path "${FFMPEG_${component}_INCLUDE_DIR}/lib${component}/version.h")
if (EXISTS "${version_header_path}")
string(TOUPPER "${component}" component_upper)
file(STRINGS "${version_header_path}" version
REGEX "#define *LIB${component_upper}_VERSION_(MAJOR|MINOR|MICRO) ")

set(version "${version_major} ${version}")
string(REGEX REPLACE ".*_MAJOR *\([0-9]*\).*" "\\1" major "${version}")
string(REGEX REPLACE ".*_MINOR *\([0-9]*\).*" "\\1" minor "${version}")
string(REGEX REPLACE ".*_MICRO *\([0-9]*\).*" "\\1" micro "${version}")
Expand Down

0 comments on commit e734d17

Please sign in to comment.