From 75f557869ff7bd9e667f7715c23051bc9124bfa7 Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Wed, 18 Oct 2023 12:26:50 -0300 Subject: [PATCH] build: bump minimum CMake version to 3.12 --- CHANGES.md | 1 + CMakeLists.txt | 2 +- ns3 | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f49cff082..5ab45ddae 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d1a08365..ae93af658 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 # diff --git a/ns3 b/ns3 index 3eec468f7..fd27bfa59 100755 --- a/ns3 +++ b/ns3 @@ -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