File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 3636 run : |
3737 if [[ "${{ matrix.compiler.cc }}" == "clang"* ]]; then
3838 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
39+ VERSION="${{ matrix.compiler.cc }}"
40+ VERSION="${VERSION#clang-}"
3941 # Add repositories based on Ubuntu version
4042 if [[ "${{ matrix.compiler.os }}" == "ubuntu-22.04" ]]; then
4143 sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-13 main"
5355 sudo apt-add-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble main"
5456 fi
5557 sudo apt update
56- sudo apt install ${{ matrix.compiler.cc }} -y
58+ sudo apt install ${{ matrix.compiler.cc }} libc++-${VERSION}-dev libc++abi-${VERSION}-dev -y
5759 fi
5860
5961 - name : Configure gcc
Original file line number Diff line number Diff line change @@ -58,6 +58,16 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
5858 set (CMAKE_VERBOSE_MAKEFILE ON )
5959 set (OPTIONS -Wall -Wextra -Wshadow -pedantic-errors -Werror)
6060
61+ # Clang should use its native libc++ instead of libstdc++
62+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
63+ set (OPTIONS ${OPTIONS} -stdlib=libc++)
64+
65+ # Clang 22+ treats __COUNTER__ as C2y extension, but Catch2 v2 uses it
66+ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "22.0" )
67+ set (OPTIONS ${OPTIONS} -Wno-c2y-extensions)
68+ endif ()
69+ endif ()
70+
6171 check_cxx_compiler_flag (-std=c++20 HAS_CPP20_FLAG )
6272 check_cxx_compiler_flag (-std=c++23 HAS_CPP23_FLAG )
6373endif ()
@@ -71,6 +81,12 @@ function(make_test src target std)
7181 else ()
7282 target_link_libraries (${target} PRIVATE magic_enum::magic_enum )
7383 endif ()
84+
85+ # Link with libc++ for Clang
86+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
87+ target_link_libraries (${target} PRIVATE c++ c++abi )
88+ endif ()
89+
7490 set_target_properties (${target} PROPERTIES CXX_EXTENSIONS OFF )
7591 if (std)
7692 if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
You can’t perform that action at this time.
0 commit comments