diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-04-05 12:27:09 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-04-05 12:27:09 +0200 |
| commit | 5b63adcc9e80a04cf8909a67857d284eff87b398 (patch) | |
| tree | 547b3e77110b2d0a3f6ca5125d0d580d09fde7b6 | |
| parent | f0a05bebbea8f123070d0da60d781c8ca07ecb4f (diff) | |
| download | dynstr-5b63adcc9e80a04cf8909a67857d284eff87b398.tar.gz | |
CMakeLists.txt: Keep compatibility with CMake 4.x
CMake 4.0 and above removed support for any project defining their
cmake_minimum_required(VERSION) to 3.5 or lower.
Since this project does not require any modern version of CMake (i.e.,
3.0 and above are fine), this commit attempts to provide a flexible
approach by checking CMAKE_MAJOR_VERSION and CMAKE_MINOR_VERSION.
[1]: https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html#policy-version
| -rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 854eb5b..1cd6c0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.0) +if(CMAKE_MAJOR_VERSION GREATER 3 + OR (CMAKE_MAJOR_VERSION EQUAL 3 AND CMAKE_MINOR_VERSION GREATER 30)) + cmake_minimum_required(VERSION 3.10) +elseif(CMAKE_MAJOR_VERSION EQUAL 3 AND CMAKE_MINOR_VERSION GREATER 26) + cmake_minimum_required(VERSION 3.5) +else() + cmake_minimum_required(VERSION 3.0) +endif() + project(dynstr LANGUAGES C VERSION 0.1.0) add_library(${PROJECT_NAME} "dynstr.c") target_include_directories(${PROJECT_NAME} PUBLIC "include") |
