Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .circleci/install_cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
# Usage: ./install_cmake.sh 3.28.3
# Installs a specific CMake version on macOS from Kitware releases.
# Layout:
# /usr/local/cmake-<version>/CMake.app/Contents/bin/{cmake,ccmake,cpack,ctest}
# Symlinks:
# /usr/local/bin/{cmake,ccmake,cpack,ctest} -> .../Contents/bin/<tool>
# Works on both Intel and Apple Silicon (uses "macos-universal" tarball).

set -euo pipefail

if [ -z "${1:-}" ]; then
echo "Usage: $0 <cmake-version>"
exit 1
fi

VERSION="$1"
INSTALL_DIR="/usr/local/cmake-$VERSION"
TARBALL="cmake-$VERSION-macos-universal.tar.gz"
URL="https://github.com/Kitware/CMake/releases/download/v$VERSION/$TARBALL"
TMPFILE="/tmp/$TARBALL"

# Require basic tools
for cmd in curl tar; do
command -v "$cmd" >/dev/null || { echo "Missing $cmd"; exit 1; }
done

# Skip if already installed
if [ -d "$INSTALL_DIR" ] && [ -x "$INSTALL_DIR/CMake.app/Contents/bin/cmake" ]; then
echo "CMake $VERSION already installed at $INSTALL_DIR"
else
echo "Downloading $URL ..."
# --fail makes curl exit non-zero on 404/5xx; -L follows redirects
curl -fL "$URL" -o "$TMPFILE"

echo "Creating $INSTALL_DIR and extracting..."
sudo mkdir -p "$INSTALL_DIR"

# The tarball contains a top-level directory (e.g., cmake-<ver>-macos-universal/*)
# We strip that first component so CMake.app ends up directly under $INSTALL_DIR.
sudo tar -xzf "$TMPFILE" -C "$INSTALL_DIR" --strip-components=1

# Work around Gatekeeper quarantine if present (harmless if attribute absent)
if command -v xattr >/dev/null; then
sudo xattr -dr com.apple.quarantine "$INSTALL_DIR/CMake.app" || true
fi

# Sanity check
if [ ! -x "$INSTALL_DIR/CMake.app/Contents/bin/cmake" ]; then
echo "Error: cmake binary not found under $INSTALL_DIR/CMake.app/Contents/bin"
exit 1
fi
fi

echo "Linking command-line tools into /usr/local/bin ..."
for tool in cmake ccmake cpack ctest; do
sudo ln -sfn "$INSTALL_DIR/CMake.app/Contents/bin/$tool" "/usr/local/bin/$tool"
done

# Optional: link cmake-gui (will open the GUI app)
if [ -x "$INSTALL_DIR/CMake.app/Contents/bin/cmake-gui" ]; then
sudo ln -sfn "$INSTALL_DIR/CMake.app/Contents/bin/cmake-gui" /usr/local/bin/cmake-gui
fi

echo "CMake $VERSION installed successfully."
which cmake
cmake --version
6 changes: 5 additions & 1 deletion .circleci/osx_install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ then
brew untap homebrew/homebrew-cask-versions
brew update
brew upgrade
brew install cmake
# brew install cmake
brew install wget
brew install coreutils
brew install diffutils
brew install grep

# install historical cmake
chmod +x .circleci/install_cmake.sh
.circleci/install_cmake.sh 3.28.3

# boost
boost_version="1.84.0"
boost_package="boost_${boost_version//./_}.tar.bz2"
Expand Down
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ include_directories(SYSTEM ${JSONCPP_INCLUDE_DIR})

find_package(Threads)

if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin" AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if (CMAKE_VERSION VERSION_EQUAL "4.0.3" AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "15.0.0.15000040")
# for Apple clang 15 under cmake 4.0.0, disable pedantic warnings explicitly as it fails to treat boost properly as
# system library, warnings propagate
set(PEDANTIC OFF)
endif()
endif()

if(NOT PEDANTIC)
message(WARNING "-- Pedantic build flags turned off. Warnings will not make compilation fail. This is NOT recommended in development builds.")
endif()
Expand Down