package/pkg-cmake: fix late expansion in infra

Commit 4cf79d9b71 (pkg-cmake: add option to select the Ninja
generator) forgot to account for the late expansion rule in the inner
infrastructure macros, which breaks the build in two ways:

 1. the expansion of $(firstword $$(MAKE)) does not actually expands to
    the first word, but to the full value of $(MAKE);

 2. the paths are invalid for per-package directories.

Fix that by applying the proper double-dollar rule for inner macros.

Reported-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Yann E. MORIN 2023-08-07 19:37:32 +02:00
parent 0fe729f70e
commit a0c0bc9d33

View File

@ -65,7 +65,7 @@ endif
ifeq ($$($(3)_CMAKE_BACKEND),make)
$(2)_GENERATOR = "Unix Makefiles"
# $$(MAKE) can be 'make -jN', we just want 'make' (possibly with a full path)
$(2)_GENERATOR_PROGRAM = $(firstword $$(MAKE))
$(2)_GENERATOR_PROGRAM = $$(firstword $$(MAKE))
# Generator specific code (make) should be avoided,
# but for now, copy them to the new variables.
$(2)_BUILD_ENV ?= $$($(2)_MAKE_ENV)
@ -74,7 +74,7 @@ $(2)_BUILD_OPTS ?= -- $$($(2)_MAKE_OPTS)
else ifeq ($$($(3)_CMAKE_BACKEND),ninja)
$(2)_DEPENDENCIES += host-ninja
$(2)_GENERATOR = "Ninja"
$(2)_GENERATOR_PROGRAM = $(HOST_DIR)/bin/ninja
$(2)_GENERATOR_PROGRAM = $$(HOST_DIR)/bin/ninja
else
$$(error Unsupported cmake backend "$$($(3)_CMAKE_BACKEND)")