From 6041fd7a86e1fcebac96eb4d30fe2028089127b3 Mon Sep 17 00:00:00 2001 From: Christian Stigen Larsen Date: Thu, 23 Feb 2017 12:45:45 +0100 Subject: [PATCH] build: Makefile: Try other cmake names, or override. #6163 Distributions like RHEL7 (yum) install CMake as `cmake3`. Closes #6163 --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 2871d007d3..fed84582a9 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ filter-true = $(strip $(filter-out 1 on ON true TRUE,$1)) # See contrib/local.mk.example -include local.mk +CMAKE_PRG ?= $(shell (command -v cmake3 || echo cmake)) CMAKE_BUILD_TYPE ?= Debug CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) @@ -15,7 +16,7 @@ BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \ ifeq (,$(BUILD_TOOL)) ifeq (Ninja,$(BUILD_TYPE)) - ifneq ($(shell cmake --help 2>/dev/null | grep Ninja),) + ifneq ($(shell $(CMAKE_PRG) --help 2>/dev/null | grep Ninja),) BUILD_TOOL := ninja else # User's version of CMake doesn't support Ninja @@ -67,7 +68,7 @@ cmake: $(MAKE) build/.ran-cmake build/.ran-cmake: | deps - cd build && cmake -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) .. + cd build && $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) .. touch $@ deps: | build/.ran-third-party-cmake @@ -79,7 +80,7 @@ build/.ran-third-party-cmake: ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),) mkdir -p .deps cd .deps && \ - cmake -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \ + $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \ $(DEPS_CMAKE_FLAGS) ../third-party endif mkdir -p build @@ -126,7 +127,7 @@ install: | nvim +$(BUILD_CMD) -C build install clint: - cmake -DLINT_PRG=./src/clint.py \ + $(CMAKE_PRG) -DLINT_PRG=./src/clint.py \ -DLINT_DIR=src \ -DLINT_SUPPRESS_URL="$(DOC_DOWNLOAD_URL_BASE)$(CLINT_ERRORS_FILE_PATH)" \ -P cmake/RunLint.cmake