build: Makefile: Try other cmake names, or override. #6163

Distributions like RHEL7 (yum) install CMake as `cmake3`.

Closes #6163
This commit is contained in:
Christian Stigen Larsen 2017-02-23 12:45:45 +01:00 committed by Justin M. Keyes
parent c318d8e672
commit 6041fd7a86

View File

@ -4,6 +4,7 @@ filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
# See contrib/local.mk.example # See contrib/local.mk.example
-include local.mk -include local.mk
CMAKE_PRG ?= $(shell (command -v cmake3 || echo cmake))
CMAKE_BUILD_TYPE ?= Debug CMAKE_BUILD_TYPE ?= Debug
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) 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 (,$(BUILD_TOOL))
ifeq (Ninja,$(BUILD_TYPE)) 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 BUILD_TOOL := ninja
else else
# User's version of CMake doesn't support Ninja # User's version of CMake doesn't support Ninja
@ -67,7 +68,7 @@ cmake:
$(MAKE) build/.ran-cmake $(MAKE) build/.ran-cmake
build/.ran-cmake: | deps 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 $@ touch $@
deps: | build/.ran-third-party-cmake deps: | build/.ran-third-party-cmake
@ -79,7 +80,7 @@ build/.ran-third-party-cmake:
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),) ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
mkdir -p .deps mkdir -p .deps
cd .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 $(DEPS_CMAKE_FLAGS) ../third-party
endif endif
mkdir -p build mkdir -p build
@ -126,7 +127,7 @@ install: | nvim
+$(BUILD_CMD) -C build install +$(BUILD_CMD) -C build install
clint: clint:
cmake -DLINT_PRG=./src/clint.py \ $(CMAKE_PRG) -DLINT_PRG=./src/clint.py \
-DLINT_DIR=src \ -DLINT_DIR=src \
-DLINT_SUPPRESS_URL="$(DOC_DOWNLOAD_URL_BASE)$(CLINT_ERRORS_FILE_PATH)" \ -DLINT_SUPPRESS_URL="$(DOC_DOWNLOAD_URL_BASE)$(CLINT_ERRORS_FILE_PATH)" \
-P cmake/RunLint.cmake -P cmake/RunLint.cmake