Skip to content

Commit 66915a0

Browse files
authored
[system-dependencies] Add logic to auto-provision cmake. (dotnet#940)
1 parent 9b7feaa commit 66915a0

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

system-dependencies.sh

+19-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,15 @@ while ! test -z $1; do
2626
PROVISION_MONO=1
2727
shift
2828
;;
29+
--provision-cmake)
30+
PROVISION_CMAKE=1
31+
shift
32+
;;
2933
--provision-all)
3034
PROVISION_MONO=1
3135
PROVISION_XS=1
3236
PROVISION_XCODE=1
37+
PROVISION_CMAKE=1
3338
shift
3439
;;
3540
--ignore-osx)
@@ -459,14 +464,27 @@ function check_osx_version () {
459464
ok "Found OSX $ACTUAL_OSX_VERSION (at least $MIN_OSX_BUILD_VERSION is required)"
460465
}
461466

467+
function install_cmake () {
468+
if ! brew --version >& /dev/null; then
469+
fail "Asked to install cmake, but brew is not installed."
470+
return
471+
fi
472+
473+
brew install cmake
474+
}
475+
462476
function check_cmake () {
463477
if ! test -z $IGNORE_CMAKE; then return; fi
464478

465479
local MIN_CMAKE_VERSION=`grep MIN_CMAKE_VERSION= Make.config | sed 's/.*=//'`
466480
local CMAKE_URL=`grep CMAKE_URL= Make.config | sed 's/.*=//'`
467481

468482
if ! cmake --version &> /dev/null; then
469-
fail "You must install CMake ($CMAKE_URL)"
483+
if ! test -z $PROVISION_CMAKE; then
484+
install_cmake
485+
else
486+
fail "You must install CMake ($CMAKE_URL)"
487+
fi
470488
return
471489
fi
472490

tests/test-dependencies.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash -ex
22

33
cd $(dirname $0)
4-
./system-dependencies.sh --provision-mono --ignore-autotools --ignore-xamarin-studio --ignore-xcode --ignore-osx
4+
./system-dependencies.sh --provision-mono --ignore-autotools --ignore-xamarin-studio --ignore-xcode --ignore-osx --ignore-cmake

0 commit comments

Comments
 (0)