Skip to content

fix srt cmake 4.x compiling error. v7.0.52 - #4431

Merged
winlinvip merged 4 commits into
ossrs:developfrom
suzp1984:fix/cmake_minimum_compatible
Aug 12, 2025
Merged

fix srt cmake 4.x compiling error. v7.0.52#4431
winlinvip merged 4 commits into
ossrs:developfrom
suzp1984:fix/cmake_minimum_compatible

Conversation

@suzp1984

@suzp1984 suzp1984 commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

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 value. Or, use the ... syntax
to tell CMake that the project requires at least but has been updated
to work with policies introduced by 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

CMake 4.x not long compatible with function cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) with only min version anymore.
@winlinvip winlinvip added the EnglishNative This issue is conveyed exclusively in English. label Aug 11, 2025
@duiniuluantanqin

Copy link
Copy Markdown
Member

CMake 4 is indeed not backward-compatible.

@winlinvip
winlinvip force-pushed the fix/cmake_minimum_compatible branch from 6626dc3 to d27469b Compare August 12, 2025 12:18
@winlinvip winlinvip changed the title fix srt cmake 4.x compiling error. fix srt cmake 4.x compiling error. v7.0.52 Aug 12, 2025
@winlinvip winlinvip added the RefinedByAI Refined by AI/GPT. label Aug 12, 2025
@winlinvip
winlinvip merged commit f2e56c7 into ossrs:develop Aug 12, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

EnglishNative This issue is conveyed exclusively in English. RefinedByAI Refined by AI/GPT.

Development

Successfully merging this pull request may close these issues.

4 participants