build: bump minimum CMake version to 3.12

This commit is contained in:
Gabriel Ferreira
2023-10-18 12:26:50 -03:00
parent 4e06af5256
commit 75f557869f
3 changed files with 7 additions and 4 deletions

View File

@@ -31,6 +31,7 @@ Changes from ns-3.40 to ns-3-dev
* In preparation to enable C++20, the following actions have been taken due to compiler issues:
* Precompiled headers have been disabled in GCC versions >= 12.2.
* The `restrict` warning has been disabled in GCC versions 12.1-12.3.1.
* Raised minimum CMake version to 3.12.
### Changed behavior

View File

@@ -1,7 +1,7 @@
# ##############################################################################
# Required CMake version #
# ##############################################################################
cmake_minimum_required(VERSION 3.10..3.10)
cmake_minimum_required(VERSION 3.12..3.12)
# ##############################################################################
# Project name #

8
ns3
View File

@@ -858,16 +858,18 @@ def parse_version(version_str):
def cmake_check_version():
# Check CMake version
minimum_cmake_version = "3.12.0"
cmake3 = shutil.which("cmake3")
cmake = cmake3 if cmake3 else shutil.which("cmake")
if not cmake:
print("Error: CMake not found; please install version 3.10 or greater, or modify", path_variable)
print(
f"Error: CMake not found; please install version {minimum_cmake_version} or greater, or modify {path_variable}")
exit(1)
cmake = cmake.replace(".EXE", "").replace(".exe", "") # Trim cmake executable extension
cmake_output = subprocess.check_output([cmake, "--version"]).decode("utf-8")
version = re.findall("version (.*)", cmake_output)[0]
if parse_version(version) < parse_version("3.10.0"):
print("Error: CMake found at %s but version %s is older than 3.10" % (cmake, version))
if parse_version(version) < parse_version(minimum_cmake_version):
print(f"Error: CMake found at {cmake} but version {version} is older than {minimum_cmake_version}")
exit(1)
return cmake, version