diff --git a/test/common.py b/test/common.py index 613d0fcff75a3..6e9cbc94b3ef7 100644 --- a/test/common.py +++ b/test/common.py @@ -1571,7 +1571,9 @@ def build_library(self, name, build_dir, generated_libs, configure, make, make_a # cross compiling. if configure: if configure[0] == 'cmake': - configure = [EMCMAKE] + configure + # Some tests have very old cmake_minimum_version settings which is not supported by cmake 4+. + # Forcing a slighly more recent cmake_minimum_version works around this issue. + configure = [EMCMAKE] + configure + ['-DCMAKE_POLICY_VERSION_MINIMUM=3.5'] else: configure = [EMCONFIGURE] + configure else: diff --git a/test/test_other.py b/test/test_other.py index 46637386f834b..843daed807e40 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -945,7 +945,10 @@ def test_cmake(self, test_dir, output_file, cmake_args): os.mkdir(builddir) with common.chdir(builddir): # Run Cmake - cmd = [EMCMAKE, 'cmake'] + cmake_args + ['-G', generator, cmakelistsdir] + + # Some tests have very old cmake_minimum_version settings which is not supported by cmake 4+. + # Forcing a slighly more recent cmake_minimum_version works around this issue. + cmd = [EMCMAKE, 'cmake'] + cmake_args + ['-G', generator, cmakelistsdir, '-DCMAKE_POLICY_VERSION_MINIMUM=3.5'] env = os.environ.copy() # https://github.com/emscripten-core/emscripten/pull/5145: Check that CMake works even if EMCC_SKIP_SANITY_CHECK=1 is passed.