Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0097a30
fix ci
sandro-elsweijer Apr 30, 2026
f3cce7a
add newline at eof
sandro-elsweijer Apr 30, 2026
da7660f
simplify depends on cmake option by making it mandatory
sandro-elsweijer Apr 30, 2026
eb061dd
move dependencies into separate cmake script
sandro-elsweijer Apr 30, 2026
000aa1a
rename dependencies to thirdparty
sandro-elsweijer Apr 30, 2026
43d8e04
remove MakeAvailable() duplication and align fixes
sandro-elsweijer Apr 30, 2026
84b85ee
added jq to docker image instead of installing it in the ci
sandro-elsweijer Apr 30, 2026
4118df9
Reapply "Improvement: Implement FetchContent"
sandro-elsweijer Apr 30, 2026
f60b819
Merge branch 'submodule_adjustment' into reintroduce_fetchcontent
sandro-elsweijer Apr 30, 2026
48e5ac5
remove comment
sandro-elsweijer Apr 30, 2026
449bf65
increase counter [run ci]
sandro-elsweijer Apr 30, 2026
9250bb9
rename dependency file in ci [run ci]
sandro-elsweijer Apr 30, 2026
4c8a84b
reintroduce deleted comment
sandro-elsweijer Apr 30, 2026
d750d68
remove reintroduced netcdf linkage
sandro-elsweijer Apr 30, 2026
762093d
adapt path of thirdparty file in ci [run ci]
sandro-elsweijer Apr 30, 2026
ad4c88e
fix ci runner bug [run ci]
sandro-elsweijer Apr 30, 2026
0b08e59
use checkout action instead of manual checkout [run ci]
sandro-elsweijer Apr 30, 2026
50a1de9
fix checkout [run ci]
sandro-elsweijer Apr 30, 2026
37f54fa
move folder creation [run ci]
sandro-elsweijer Apr 30, 2026
da96b61
remove redundant include
sandro-elsweijer Apr 30, 2026
7a7843b
remove wrong comment
sandro-elsweijer Apr 30, 2026
254c5d5
deactivate ci caching to debug the ci
sandro-elsweijer Apr 30, 2026
9961d39
[run ci]
sandro-elsweijer Apr 30, 2026
01bbd66
fix advanced options from fetchcontent
sandro-elsweijer May 4, 2026
9e1db72
make options internal instead of advanced
sandro-elsweijer May 4, 2026
05860a7
remove git_progress due to buffer overflow
sandro-elsweijer May 4, 2026
3b5e8d1
enable cache and increase counter
sandro-elsweijer May 4, 2026
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
68 changes: 44 additions & 24 deletions .github/workflows/test_preparation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ jobs:
# This seems to be necessary because of the docker container
- name: disable ownership checks
run: git config --global --add safe.directory '*'
- name: init submodules
run: git submodule init
- name: update submodules
run: git submodule update
- name: Get input vars
run: export MAKEFLAGS="${{ inputs.MAKEFLAGS }}"
&& export IGNORE_CACHE="${{ inputs.IGNORE_CACHE }}"
Expand All @@ -85,11 +81,16 @@ jobs:
# SC installation
#
- name: store sc folders in var
run: echo SC_BUILD=$PWD/sc/build >> $GITHUB_ENV
run: echo SC_SOURCE=$PWD/sc >> $GITHUB_ENV
&& echo SC_BUILD=$PWD/sc/build >> $GITHUB_ENV
&& echo SC_DEBUG=$PWD/sc/build/Debug >> $GITHUB_ENV
&& echo SC_RELEASE=$PWD/sc/build/Release >> $GITHUB_ENV
- name: Get sc commit hash
run: hash=`git rev-parse HEAD:sc` && echo sc_commit=$hash >> $GITHUB_ENV
- name: Get sc commit hash and url from thirdparty.json
run: |
hash=$(jq -r '.thirdparty[] | select(.name=="SC") .source.ref' cmake/thirdparty.json)
echo sc_commit=$hash >> $GITHUB_ENV
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lower case GITHUB_ENV vars vs. upper case above.
Is this ok?

url=$(jq -r '.thirdparty[] | select(.name=="SC") .source.url' cmake/thirdparty.json)
echo sc_url=$url >> $GITHUB_ENV
- name: Check cache for previous sc installation
id: sc_cmake_cache
uses: actions/cache@v5
Expand All @@ -109,22 +110,29 @@ jobs:
if: ${{ inputs.IGNORE_CACHE == 1 }}
# The true at the end is to ignore errors that i.e. occur when the folders do not exist
run: rm -r $SC_BUILD || true
- name: make folders
run: mkdir -p $SC_DEBUG $SC_RELEASE
if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
- name: install sc
run: echo "Install sc"
if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
## sc debug
- uses: actions/checkout@v6
with:
repository: cburstedde/libsc
ref: ${{ env.sc_commit }}
fetch-depth: 1
path: ${{ env.SC_SOURCE }}
if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
- name: make folders
run: mkdir -p $SC_DEBUG $SC_RELEASE
if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
## sc debug build
- name: sc cmake debug
run: cd $SC_DEBUG && cmake ../../ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$SC_DEBUG/install -Dmpi=$MPI -GNinja
run: cd $SC_DEBUG && cmake $SC_SOURCE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$SC_DEBUG/install -Dmpi=$MPI -GNinja
if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
- name: sc build debug
run: cd $SC_DEBUG && ninja $MAKEFLAGS && ninja $MAKEFLAGS install
if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
## sc release
## sc release build
- name: sc cmake release
run: cd $SC_RELEASE && cmake ../../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$SC_RELEASE/install -Dmpi=$MPI -GNinja
run: cd $SC_RELEASE && cmake $SC_SOURCE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$SC_RELEASE/install -Dmpi=$MPI -GNinja
if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
- name: sc build release
run: cd $SC_RELEASE && ninja $MAKEFLAGS && ninja $MAKEFLAGS install
Expand All @@ -133,11 +141,16 @@ jobs:
# P4EST
#
- name: store p4est folders in var
run: echo P4EST_BUILD=$PWD/p4est/build >> $GITHUB_ENV
run: echo P4EST_SOURCE=$PWD/p4est >> $GITHUB_ENV
&& echo P4EST_BUILD=$PWD/p4est/build >> $GITHUB_ENV
&& echo P4EST_DEBUG=$PWD/p4est/build/Debug >> $GITHUB_ENV
&& echo P4EST_RELEASE=$PWD/p4est/build/Release >> $GITHUB_ENV
- name: Get p4est commit hash
run: hash=`git rev-parse HEAD:p4est` && echo p4est_commit=$hash >> $GITHUB_ENV
- name: Get p4est commit hash and url from thirdparty.json
run: |
hash=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.ref' cmake/thirdparty.json)
echo p4est_commit=$hash >> $GITHUB_ENV
url=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.url' cmake/thirdparty.json)
echo p4est_url=$url >> $GITHUB_ENV
- name: Check cache for previous p4est installation
id: p4est_cmake_cache
uses: actions/cache@v5
Expand All @@ -153,26 +166,33 @@ jobs:
- name: Cache info
if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
run: echo No cache found or cache will be ignored. IGNORE_CACHE=$IGNORE_CACHE
- name: install p4est
run: echo "Install p4est"
if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
- name: if ignore cache, delete folders
if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
# The true at the end is to ignore errors that i.e. occur when the folders do not exist
run: rm -r $P4EST_BUILD || true
- name: install p4est
run: echo "Install p4est"
if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
- uses: actions/checkout@v6
with:
repository: cburstedde/p4est
ref: ${{ env.p4est_commit }}
fetch-depth: 1
path: ${{ env.P4EST_SOURCE }}
if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
- name: make folders
if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
run: mkdir -p $P4EST_DEBUG $P4EST_RELEASE
## p4est debug
## p4est debug build
- name: p4est cmake debug
run: cd $P4EST_DEBUG && cmake ../../ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$P4EST_DEBUG/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja
run: cd $P4EST_DEBUG && cmake $P4EST_SOURCE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$P4EST_DEBUG/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja
if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
- name: p4est build debug
run: cd $P4EST_DEBUG && ninja $MAKEFLAGS && ninja $MAKEFLAGS install
if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
## p4est release
## p4est release build
- name: p4est cmake release
run: cd $P4EST_RELEASE && cmake ../../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$P4EST_RELEASE/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja
run: cd $P4EST_RELEASE && cmake $P4EST_SOURCE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$P4EST_RELEASE/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_RELEASE/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja
if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }}
- name: p4est build release
run: cd $P4EST_RELEASE && ninja $MAKEFLAGS && ninja $MAKEFLAGS install
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test_t8code_w_shipped_submodules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ jobs:
# This seems to be necessary because of the docker container
- name: disable ownership checks
run: git config --global --add safe.directory '*'
- name: init submodules
run: git submodule init
- name: update submodules
run: git submodule update
- name: Get input vars
run: export MAKEFLAGS="${{ inputs.MAKEFLAGS }}"
&& export MPI="${{ inputs.MPI }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
with:
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run
CACHE_COUNTER: 0 # Increase this number to force a new installation of sc and p4est and to update the cache once
CACHE_COUNTER: 8 # Increase this number to force a new installation of sc and p4est and to update the cache once
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8 is king?

MPI: ${{ matrix.MPI }}

# Run parallel tests for sc and p4est with and without MPI
Expand Down
8 changes: 0 additions & 8 deletions .gitmodules

This file was deleted.

173 changes: 69 additions & 104 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# t8code is a C library to manage a collection (a forest) of multiple
# connected adaptive space-trees of general element types in parallel.
#
# Copyright (C) 2025 the developers
# Copyright (C) 2026 the developers
#
# t8code is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -18,11 +18,9 @@
# along with t8code; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

cmake_minimum_required( VERSION 3.16 )
cmake_minimum_required( VERSION 3.19 )

include( cmake/GitProjectVersion.cmake )
include( FetchContent )
# All fetchcontent cmake options+ are marked as advanced below.

project(
T8CODE
Expand All @@ -35,18 +33,6 @@ include( GNUInstallDirs)
include( CTest )
include( CMakeDependentOption )

FetchContent_Declare(
googletest
GIT_REPOSITORY "https://github.com/DLR-SC/googletest_mpi.git"
GIT_TAG 98bfff426b057400268a00f97677d749a9e25096 #v1.17.0_mpi
GIT_PROGRESS TRUE
GIT_SHALLOW TRUE
)

set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
mark_as_advanced( FORCE gtest_force_shared_crt)


option( T8CODE_BUILD_AS_SHARED_LIBRARY "Whether t8code should be built as a shared or a static library" ON )
option( T8CODE_BUILD_PEDANTIC "Compile t8code with `-pedantic` as done in the Github CI." OFF )
option( T8CODE_BUILD_WALL "Compile t8code with `-Wall` as done in the Github CI." OFF )
Expand Down Expand Up @@ -124,17 +110,79 @@ if( T8CODE_ENABLE_MPI )
else()
find_package( MPI 3.0 COMPONENTS C REQUIRED )
endif()
set (gtest_disable_mpi OFF CACHE BOOL "disable gtest mpi support" FORCE)
set (gtest_disable_mpi OFF CACHE INTERNAL "disable gtest mpi support" FORCE)

if( NOT MPIEXEC_EXECUTABLE )
message( FATAL_ERROR "MPIEXEC was not found" )
endif()
set( SC_ENABLE_MPI ON )
set( SC_ENABLE_MPI ON CACHE INTERNAL "enable mpi support in libsc" FORCE)
else()
set( gtest_disable_mpi ON CACHE INTERNAL "disable gtest mpi support" FORCE)
endif()

############################################ ThirdParty ############################################

# Set some variables for the thirdparty libraries
set(gtest_force_shared_crt ON CACHE INTERNAL "" FORCE)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set(gtest_force_shared_crt ON CACHE INTERNAL "" FORCE)
set( gtest_force_shared_crt ON CACHE INTERNAL "" FORCE )

set( P4EST_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} )
set( P4EST_BUILD_TESTING ${T8CODE_BUILD_TPL_TESTS} )
set( SC_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} )
set( SC_BUILD_TESTING ${T8CODE_BUILD_TPL_TESTS} )

# When executing CMake tests for some thirdparty libraries like sc, i.e. check_c_source_compiles/check_cxx_source_compiles and others
# we need to ignore the -Werror option, since these tests often produce warnings (see check_mpicommshared.cmake from sc for example).
# If theses warnings are interpreted as errors, the test fails even though we want it to pass.
# This behaviour caused a serious bug and did not initialize our shared memory. See https://github.com/DLR-AMR/t8code/issues/1985.
set( T8CODE_OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}" )
if (WIN32 AND NOT MINGW)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /w" )
else()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -w" )
endif()

# Do the same for the normal build flags to suppress warnings from the thirdparty library
set(ORIGINAL_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(ORIGINAL_C_FLAGS "${CMAKE_C_FLAGS}")
if (WIN32 AND NOT MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w" CACHE STRING "" FORCE)
else()
set( gtest_disable_mpi ON CACHE BOOL "disable gtest mpi support" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w" CACHE STRING "" FORCE)
endif()

mark_as_advanced( FORCE gtest_disable_mpi)
# Capture the list of variables before adding the thirdparty libraries to mark the added ones as advanced.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this include the FETCHCONTENT variables, which are already marked in thirdparty.cmake?

get_cmake_property(_vars_before_thirdparty VARIABLES )

# Populate the thirdparty libraries
include (cmake/thirdparty.cmake)

# Capture the list of variables after adding thirdparty libraries
get_cmake_property(_vars_after_thirdparty VARIABLES)

# Find variables that exist after but not before
set(_new_thirdparty_vars)
foreach(_var IN LISTS _vars_after_thirdparty)
list(FIND _vars_before_thirdparty "${_var}" _index)
if(_index EQUAL -1)
list(APPEND _new_thirdparty_vars ${_var})
endif()
endforeach()

# Mark the new variables as advanced
if(_new_thirdparty_vars)
mark_as_advanced(FORCE ${_new_thirdparty_vars})
endif()

# Reactivate previous CMAKE_REQUIRED_FLAGS and CMAKE_C/CXX_FLAGS
set( CMAKE_REQUIRED_FLAGS "${T8CODE_OLD_CMAKE_REQUIRED_FLAGS}" )
unset( T8CODE_OLD_CMAKE_REQUIRED_FLAGS )
set(CMAKE_CXX_FLAGS "${ORIGINAL_CXX_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS "${ORIGINAL_C_FLAGS}" CACHE STRING "" FORCE)
unset (ORIGINAL_CXX_FLAGS)
unset (ORIGINAL_C_FLAGS)

############################################ End of ThirdParty ############################################


if( T8CODE_ENABLE_VTK )
Expand Down Expand Up @@ -183,39 +231,6 @@ endif()
if ( T8CODE_USE_SYSTEM_SC )
find_package( SC REQUIRED )
else()
set( SC_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} )
set( SC_BUILD_TESTING ${T8CODE_BUILD_TPL_TESTS} )

# When executing CMake tests for libsc, i.e. check_c_source_compiles/check_cxx_source_compiles and others
# we need to ignore the -Werror option, since these tests often produce warnings (see check_mpicommshared.cmake for example).
# If theses warnings are interpreted as errors, the test fails even though we want it to pass.
# This behaviour caused a serious bug and did not initialize our shared memory. See https://github.com/DLR-AMR/t8code/issues/1985.
set( T8CODE_OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}" )
if (WIN32 AND NOT MINGW)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /w" )
else()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -w" )
endif()

# Capture the list of variables before adding the subdirectory to mark the added ones as advanced.
get_cmake_property(_vars_before_sc VARIABLES )
list( APPEND CMAKE_MESSAGE_CONTEXT "sc" )
add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/sc )
list( POP_BACK CMAKE_MESSAGE_CONTEXT )
add_library(SC INTERFACE)
# Capture the list of variables after adding the subdirectory
get_cmake_property(_vars_after_sc VARIABLES )
# Compute the difference (new variables added by the subdirectory)
set( _new_sc_vars)
foreach( _var IN LISTS _vars_after_sc )
if( NOT _var IN_LIST _vars_before_sc )
list( APPEND _new_sc_vars ${_var} )
endif()
endforeach()

# Mark the new variables as advanced
mark_as_advanced( FORCE ${_new_sc_vars} )

########################## Fix for OpenMPI ############################################
# OpenMPI sometimes has a mismatch between their C and CXX interface which produces a warning in SC.
# The warning makes t8codes build fail when Werror is activated. This fix checks if t8code
Expand Down Expand Up @@ -247,63 +262,13 @@ else()
message(WARNING "mpi.h not found!")
endif()
########################## End of fix for OpenMPI ############################################

# Reactivate previous CMAKE_REQUIRED_FLAGS
set( CMAKE_REQUIRED_FLAGS "${T8CODE_OLD_CMAKE_REQUIRED_FLAGS}" )
unset( T8CODE_OLD_CMAKE_REQUIRED_FLAGS )
endif()


if ( T8CODE_USE_SYSTEM_P4EST )
find_package( P4EST REQUIRED )
else()
set( P4EST_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} )
set( P4EST_BUILD_TESTING ${T8CODE_BUILD_TPL_TESTS} )

# Capture the list of variables before adding the subdirectory to mark the added ones as advanced.
get_cmake_property( _vars_before_p4est VARIABLES )
list( APPEND CMAKE_MESSAGE_CONTEXT "p4est" )
add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/p4est )
list( POP_BACK CMAKE_MESSAGE_CONTEXT )
# Capture the list of variables after adding the subdirectory
get_cmake_property( _vars_after_p4est VARIABLES )
# Compute the difference (new variables added by the subdirectory)
set( _new_p4est_vars )
foreach( _var IN LISTS _vars_after_p4est )
if( NOT _var IN_LIST _vars_before_p4est )
list( APPEND _new_p4est_vars ${_var} )
endif()
endforeach()

# Mark the new variables as advanced
mark_as_advanced( FORCE ${_new_p4est_vars} )
endif()

# Workaround: Suppress warnings for googletests, so it does not compromise the usage of -WError for t8code.
# -----------
# 1. Save original flags
set(ORIGINAL_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(ORIGINAL_C_FLAGS "${CMAKE_C_FLAGS}")

# 2. Suppress warnings for GoogleTest build
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w" CACHE STRING "" FORCE)

FetchContent_MakeAvailable( googletest )

# 3. Restore original flags
set(CMAKE_CXX_FLAGS "${ORIGINAL_CXX_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS "${ORIGINAL_C_FLAGS}" CACHE STRING "" FORCE)

# End of workaround

# Mark all cmake options starting with FETCHCONTENT as advanced.
get_cmake_property(_cmake_vars VARIABLES)
foreach(_var ${_cmake_vars})
if(_var MATCHES "^FETCHCONTENT_.*")
mark_as_advanced(${_var})
endif()
endforeach()

add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/src )

if( T8CODE_BUILD_MESH_HANDLE )
Expand Down
Loading
Loading