cmake: add ZephyrAppConfiguration package

Fixes #56200
Add the ZephyrAppConfiguration package and update the corresponding
documentation. This adds flexibility to the CMake build configuration
by providing a workspace configuration package and an application
package, which only applies to the current application. The workspace
package stays the same as before, but the application package is
new and lives, per default, inside the application folder.

Signed-off-by: Nico Lüthi <nylnx@outlook.com>
This commit is contained in:
Nico Lüthi 2023-07-24 00:46:02 +02:00 committed by Carles Cufí
commit cd2a0389ed
2 changed files with 68 additions and 70 deletions

View file

@ -24,6 +24,7 @@ message(STATUS "Application: ${APPLICATION_SOURCE_DIR}")
# to CMake 3.20; this produces different binaries.
message(STATUS "CMake version: ${CMAKE_VERSION}")
# Find and execute workspace build configuration
find_package(ZephyrBuildConfiguration
QUIET NO_POLICY_SCOPE
NAMES ZephyrBuild
@ -36,6 +37,19 @@ find_package(ZephyrBuildConfiguration
NO_CMAKE_SYSTEM_PACKAGE_REGISTRY
)
# Find and execute application-specific build configuration
find_package(ZephyrAppConfiguration
QUIET NO_POLICY_SCOPE
NAMES ZephyrApp
PATHS ${APPLICATION_SOURCE_DIR}
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_PACKAGE_REGISTRY
NO_CMAKE_SYSTEM_PATH
NO_CMAKE_SYSTEM_PACKAGE_REGISTRY
)
# Test and error-out if we are affected by the PyPI CMake 3.22.1 / 3.22.2 bug
if(${CMAKE_VERSION} VERSION_EQUAL 3.22.1 OR ${CMAKE_VERSION} VERSION_EQUAL 3.22.2)
# It seems only pip-installed builds are affected so we test to see if we are affected