Update: Using C++26 with contracts enabled

This commit is contained in:
David Gil de Gómez Pérez
2026-08-12 13:47:50 +03:00
parent 206742e9b3
commit 41111dba30
6 changed files with 125 additions and 24 deletions
+22 -3
View File
@@ -1,3 +1,22 @@
# Use GCC 16 for C++26 contracts support on macOS (Homebrew).
set(CMAKE_C_COMPILER "/opt/homebrew/bin/gcc-16" CACHE FILEPATH "C compiler")
set(CMAKE_CXX_COMPILER "/opt/homebrew/bin/g++-16" CACHE FILEPATH "C++ compiler")
# GCC 16 toolchain for C++26 and contracts.
find_program(
COURSE_GCC16_C
NAMES gcc-16
HINTS /opt/homebrew/bin /usr/local/bin /opt/local/bin
)
find_program(
COURSE_GCC16_CXX
NAMES g++-16
HINTS /opt/homebrew/bin /usr/local/bin /opt/local/bin
)
if(NOT COURSE_GCC16_CXX)
message(
FATAL_ERROR
"g++-16 not found. Install GCC 16, e.g. 'brew install gcc@16', "
"then ensure g++-16 is on your PATH."
)
endif()
set(CMAKE_C_COMPILER "${COURSE_GCC16_C}" CACHE FILEPATH "C compiler" FORCE)
set(CMAKE_CXX_COMPILER "${COURSE_GCC16_CXX}" CACHE FILEPATH "C++ compiler" FORCE)