diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cd8791f..2719b0f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -55,15 +55,20 @@ jobs: sudo apt-get install -yq --no-install-recommends gcc-13 g++-13 libstdc++-13-dev - name: Prepare build + if: contains(matrix.os, 'ubuntu') run: | if [ "${{ matrix.compiler }}" = "gcc" ]; then cmake -B build -DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCOMMON_BUILD_TESTS=ON -DCMKR_SKIP_GENERATION=ON elif [ "${{ matrix.compiler }}" = "clang" ]; then cmake -B build -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCOMMON_BUILD_TESTS=ON -DCMKR_SKIP_GENERATION=ON else - cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCOMMON_BUILD_TESTS=ON -DCMKR_SKIP_GENERATION=ON + exit 1 fi + - name: Prepare build (Windows) + if: contains(matrix.os, 'windows') + run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCOMMON_BUILD_TESTS=ON -DCMKR_SKIP_GENERATION=ON + - name: Build run: cmake --build build --config ${{ env.BUILD_TYPE }} --parallel diff --git a/CMakeLists.txt b/CMakeLists.txt index 04aaf4d..b878080 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,10 @@ target_include_directories(common INTERFACE add_library(common-project INTERFACE) add_library(es3n1n::common::project ALIAS common-project) +target_compile_features(common-project INTERFACE + cxx_std_23 +) + if(MSVC) # msvc target_compile_options(common-project INTERFACE "/MP" @@ -92,12 +96,8 @@ if(UNIX) # Enforcing libc++ on clang if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "^MSVC$") OR (CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "^MSVC$")) # clang - target_compile_options(common-project INTERFACE - -stdlib=libc++ - ) - target_link_libraries(common-project INTERFACE - -stdlib=libc++ - ) + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" CACHE STRING "" FORCE) endif() endif() diff --git a/cmake.toml b/cmake.toml index d6f4aeb..283109c 100644 --- a/cmake.toml +++ b/cmake.toml @@ -34,18 +34,15 @@ condition = "common-build-benchmarks" [target.common-project] alias = "es3n1n::common::project" type = "interface" +compile-features = ["cxx_std_23"] msvc.compile-options = ["/MP"] cmake-after = """ if(UNIX) # Enforcing libc++ on clang if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "^MSVC$") OR (CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "^MSVC$")) # clang - target_compile_options(common-project INTERFACE - -stdlib=libc++ - ) - target_link_libraries(common-project INTERFACE - -stdlib=libc++ - ) + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" CACHE STRING "" FORCE) endif() endif() """