diff --git a/CMakeLists.txt b/CMakeLists.txt index 95013ba1b..82b7fa1fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,9 +18,13 @@ message(STATUS "p4est ${PROJECT_VERSION} " # --- external libs -include(cmake/GitSubmodule.cmake) -git_submodule("${PROJECT_SOURCE_DIR}/sc") -add_subdirectory(sc) +# Skip `libsc` if already registered. This is useful when `p4est` is added as a +# dependency by another software project which in turn already registered `libsc`. +if(NOT TARGET SC::SC) + include(cmake/GitSubmodule.cmake) + git_submodule("${PROJECT_SOURCE_DIR}/sc") + add_subdirectory(sc) +endif() # --- configure p4est