Fix make BUILD_CMAKE_ARGS not combining with targets like ninja and lite
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 12 Nov 2019 14:52:04 +0000 (15:52 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 22 Nov 2019 16:38:15 +0000 (17:38 +0100)
Previously make BUILD_CMAKE_ARGS="" on Linux and macOS would override any cmake
arguments that come from the targets. Now they are concatenated.

GNUmakefile

index accedbbbe4b886a034fd6860fec946edd92e8c6a..9b2ebad1e8ed97046f0d22a7b84eb0c3b81712e4 100644 (file)
@@ -163,9 +163,8 @@ CPU:=$(shell uname -m)
 BLENDER_DIR:=$(shell pwd -P)
 BUILD_TYPE:=Release
 
-ifndef BUILD_CMAKE_ARGS
-       BUILD_CMAKE_ARGS:=
-endif
+# CMake arguments, assigned to local variable to make it mutable.
+CMAKE_CONFIG_ARGS := $(BUILD_CMAKE_ARGS)
 
 ifndef BUILD_DIR
        BUILD_DIR:=$(shell dirname "$(BLENDER_DIR)")/build_$(OS_NCASE)
@@ -213,34 +212,34 @@ ifneq "$(findstring debug, $(MAKECMDGOALS))" ""
 endif
 ifneq "$(findstring full, $(MAKECMDGOALS))" ""
        BUILD_DIR:=$(BUILD_DIR)_full
-       BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_full.cmake"
+       CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_full.cmake" $(CMAKE_CONFIG_ARGS)
 endif
 ifneq "$(findstring lite, $(MAKECMDGOALS))" ""
        BUILD_DIR:=$(BUILD_DIR)_lite
-       BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_lite.cmake"
+       CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_lite.cmake" $(CMAKE_CONFIG_ARGS)
 endif
 ifneq "$(findstring cycles, $(MAKECMDGOALS))" ""
        BUILD_DIR:=$(BUILD_DIR)_cycles
-       BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/cycles_standalone.cmake"
+       CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/cycles_standalone.cmake" $(CMAKE_CONFIG_ARGS)
 endif
 ifneq "$(findstring headless, $(MAKECMDGOALS))" ""
        BUILD_DIR:=$(BUILD_DIR)_headless
-       BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_headless.cmake"
+       CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_headless.cmake" $(CMAKE_CONFIG_ARGS)
 endif
 ifneq "$(findstring bpy, $(MAKECMDGOALS))" ""
        BUILD_DIR:=$(BUILD_DIR)_bpy
-       BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/bpy_module.cmake"
+       CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/bpy_module.cmake" $(CMAKE_CONFIG_ARGS)
 endif
 
 ifneq "$(findstring developer, $(MAKECMDGOALS))" ""
-       BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_developer.cmake"
+       CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_developer.cmake" $(CMAKE_CONFIG_ARGS)
 endif
 
 # -----------------------------------------------------------------------------
 # build tool
 
 ifneq "$(findstring ninja, $(MAKECMDGOALS))" ""
-       BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -G Ninja
+       CMAKE_CONFIG_ARGS:=$(CMAKE_CONFIG_ARGS) -G Ninja
        BUILD_COMMAND:=ninja
        DEPS_BUILD_COMMAND:=ninja
 else
@@ -288,7 +287,7 @@ endif
 # -----------------------------------------------------------------------------
 # Macro for configuring cmake
 
-CMAKE_CONFIG = cmake $(BUILD_CMAKE_ARGS) \
+CMAKE_CONFIG = cmake $(CMAKE_CONFIG_ARGS) \
                      -H"$(BLENDER_DIR)" \
                      -B"$(BUILD_DIR)" \
                      -DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE)