Skip to content

Commit f2e56c7

Browse files
suzp1984duiniuluantanqinossrs-ai
authored
fix srt cmake 4.x compiling error. v7.0.52 (#4431)
## How to reproduce? 1. cmake version 4.0.3 2. clean srt build cache: `rm -rf objs/Platform-*` 3. `./configure` compiling error output: > Build srt-1-fit > patching file './objs/Platform-SRS7-Darwin-24.6.0-Clang17.0.0-arm64/srt-1-fit/srtcore/api.cpp' > Running: cmake . -DCMAKE_INSTALL_PREFIX=/Users/jacobsu/hack/media/srs/trunk/objs/Platform-SRS7-Darwin-24.6.0-Clang17.0.0-arm64/3rdparty/srt -DENABLE_APPS=0 -DENABLE_STATIC=1 -DENABLE_CXX11=0 -DENABLE_SHARED=0 -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib/libcrypto.a > CMake Error at CMakeLists.txt:10 (cmake_minimum_required): > Compatibility with CMake < 3.5 has been removed from CMake. > > Update the VERSION argument <min> value. Or, use the <min>...<max> syntax > to tell CMake that the project requires at least <min> but has been updated > to work with policies introduced by <max> or earlier. > > Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway. > > -- Configuring incomplete, errors occurred! ## Cause CMake 4.x not long compatible with function cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) with only min version anymore. ## Solution add `add -DCMAKE_POLICY_VERSION_MINIMUM=3.5` to cmake cmd args. --------- Co-authored-by: Haibo Chen <495810242@qq.com> Co-authored-by: OSSRS-AI <winlinam@gmail.com>
1 parent 6e1134f commit f2e56c7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

trunk/auto/depends.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,11 @@ fi
693693
if [[ $SRS_SRT == YES && $SRS_USE_SYS_SRT == NO ]]; then
694694
# Always disable c++11 for libsrt, because only the srt-app requres it.
695695
LIBSRT_OPTIONS="--enable-apps=0 --enable-static=1 --enable-c++11=0"
696+
CMAKE_VERSION=$(cmake --version | head -n1 | cut -d' ' -f3)
697+
CMAKE_MAJOR=$(echo $CMAKE_VERSION | cut -d'.' -f1)
698+
if [[ $CMAKE_MAJOR -ge 4 ]]; then
699+
LIBSRT_OPTIONS="$LIBSRT_OPTIONS --CMAKE_POLICY_VERSION_MINIMUM=3.5"
700+
fi
696701
if [[ $SRS_SHARED_SRT == YES ]]; then
697702
LIBSRT_OPTIONS="$LIBSRT_OPTIONS --enable-shared=1"
698703
else

trunk/doc/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The changelog for SRS.
77
<a name="v7-changes"></a>
88

99
## SRS 7.0 Changelog
10+
* v7.0, 2025-08-12, Merge [#4431](https://github.com/ossrs/srs/pull/4431): fix srt cmake 4.x compiling error. v7.0.52 (#4431)
1011
* v7.0, 2025-08-11, Merge [#4433](https://github.com/ossrs/srs/pull/4433): Use clang format. v7.0.52 (#4433)
1112
* v7.0, 2025-08-11, Merge [#4159](https://github.com/ossrs/srs/pull/4159): Feature: Support HLS with fmp4 segment for HEVC/LLHLS. v7.0.51 (#4159)
1213
* v7.0, 2025-08-11, Merge [#4432](https://github.com/ossrs/srs/pull/4432): AI: HTTP-FLV: Fix heap-use-after-free crash during stream unmount. v7.0.50 (#4432)

0 commit comments

Comments
 (0)