From 163bcbad3cdd72a311888b1045d9f7bc9a7e8540 Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Thu, 10 Jul 2025 14:12:15 +0200 Subject: [PATCH] feat(cmakev2/idf): add IDF_VERSION variables The version.cmake file should be the sole file used from the cmakev1 build system. There's no need to maintain the IDF_VERSION information in two separate locations. Signed-off-by: Frantisek Hrbata --- tools/cmakev2/idf.cmake | 5 ++++- tools/cmakev2/test/CMakeLists.txt | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/cmakev2/idf.cmake b/tools/cmakev2/idf.cmake index 2c1b10588b7..1d13cabd79a 100644 --- a/tools/cmakev2/idf.cmake +++ b/tools/cmakev2/idf.cmake @@ -9,6 +9,10 @@ cmake_minimum_required(VERSION 3.22) # included. set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}" ${CMAKE_MODULE_PATH}) +# The version.cmake file, which contains the IDF_VERSION variables, is the only +# file included from the cmakev1 build system. +include(${CMAKE_CURRENT_LIST_DIR}/../cmake/version.cmake) + include(component) include(build) @@ -152,7 +156,6 @@ __init_components() Many of the following things are already implemented in PoC !38337, but they need to be reviewed. -* Set IDF version. * Set and check python interpreter. * Set build target. * Set the toolchain before invoking project(). diff --git a/tools/cmakev2/test/CMakeLists.txt b/tools/cmakev2/test/CMakeLists.txt index fc3cf158156..77835c5ffc1 100644 --- a/tools/cmakev2/test/CMakeLists.txt +++ b/tools/cmakev2/test/CMakeLists.txt @@ -65,6 +65,19 @@ function(test_component_priority) __dump_component_properties("${component_name}") endfunction() +# Test that IDF_VERSION is set +function(test_idf_version) + if(NOT DEFINED IDF_VERSION_MAJOR OR + NOT DEFINED IDF_VERSION_MINOR OR + NOT DEFINED IDF_VERSION_PATCH OR + NOT DEFINED ENV{IDF_VERSION}) + idf_die("IDF_VERSION not set") + endif() +endfunction() + # Run tests test_dump_properties() test_component_priority() +test_idf_version() + +message("ALL TESTS PASSED")