@@ -227,16 +227,31 @@ jobs:
227227 shell : bash
228228
229229 - name : Install CMake
230- if : runner.os == 'Linux' && inputs.cmake != ''
231230 # CMakeLists.txt specifies a minimum CMake version of 3.14 for
232- # the Imath project, so use that for the CI. Except that the
233- # conan toolchain requires a minimum of 3.15, so use that for
234- # the runs that require conan.
231+ # the Imath project, so use that for the CI, unless a specific
232+ # version is specified. The conan toolchain requires a minimum
233+ # of 3.15, so use that for the runs that require conan.
235234 run : |
236- CMAKE_VERSION=${{ inputs.cmake }}
237- wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz
238- tar -xzf cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz
239- echo "CMAKE=$PWD/cmake-$CMAKE_VERSION-Linux-x86_64/bin/cmake" >> $GITHUB_ENV
235+ set -ex
236+ CMAKE=cmake
237+ CTEST=ctest
238+ if [ "${{ inputs.cmake }}" != "" ]; then
239+ if [ "$RUNNER_OS" == "Linux" ]; then
240+ CMAKE_VERSION=${{ inputs.cmake }}
241+ CURRENT_CMAKE_VERSION=$(cmake --version | head -n 1 | cut -f3 -d' ')
242+ if [ "$CMAKE_VERSION" != "$CURRENT_CMAKE_VERSION" ]; then
243+ wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz
244+ tar -xzf cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz
245+ CMAKE=$(find "$PWD" -type f -path "*/bin/cmake" | head -n 1)
246+ CTEST=$(find "$PWD" -type f -path "*/bin/ctest" | head -n 1)
247+ fi
248+ else
249+ echo "Explicit cmake version only supported on Linux."
250+ exit 1
251+ fi
252+ fi
253+ echo CMAKE="$CMAKE" >> $GITHUB_ENV
254+ echo CTEST="$CTEST" >> $GITHUB_ENV
240255 shell : bash
241256
242257 - name : Construct CMake command
@@ -424,7 +439,7 @@ jobs:
424439 set -x
425440 export PATH="$IMATH_PATH:$PATH"
426441 export PYTHONPATH=$PYTHON_INSTALL_DIR
427- ctest -T Test -C ${{ inputs.build-type }} --test-dir $BUILD_DIR --timeout 7200 --output-on-failure -VV
442+ $CTEST -T Test -C ${{ inputs.build-type }} --test-dir $BUILD_DIR --timeout 7200 --output-on-failure -VV
428443 shell : bash
429444
430445 - name : Test (msys2)
@@ -434,7 +449,7 @@ jobs:
434449 set -x
435450 export PATH="$IMATH_PATH:$PATH"
436451 export PYTHONPATH=$PYTHON_INSTALL_DIR
437- ctest -T Test -C ${{ inputs.build-type }} --test-dir $BUILD_DIR --timeout 7200 --output-on-failure -VV
452+ $CTEST -T Test -C ${{ inputs.build-type }} --test-dir $BUILD_DIR --timeout 7200 --output-on-failure -VV
438453 shell : msys2 {0}
439454
440455 - name : Prepare install_manifest
0 commit comments