From bba4c64a81effa204cf2d23a7416317196a86c63 Mon Sep 17 00:00:00 2001 From: Stardust0831 <169599847+Stardust0831@users.noreply.github.com> Date: Wed, 19 Aug 2026 02:16:32 +0800 Subject: [PATCH] CMake: build serial unit tests without MPI --- source/source_basis/module_pw/CMakeLists.txt | 2 +- source/source_cell/CMakeLists.txt | 2 +- source/source_cell/test/CMakeLists.txt | 4 ++++ source/source_io/CMakeLists.txt | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/source_basis/module_pw/CMakeLists.txt b/source/source_basis/module_pw/CMakeLists.txt index 41efac3a0e..ebb9f8673a 100644 --- a/source/source_basis/module_pw/CMakeLists.txt +++ b/source/source_basis/module_pw/CMakeLists.txt @@ -54,9 +54,9 @@ if(ENABLE_COVERAGE) endif() if(BUILD_TESTING) + add_subdirectory(test_serial) if(ENABLE_MPI) add_subdirectory(test) - add_subdirectory(test_serial) add_subdirectory(kernels/test) add_subdirectory(test_gpu) endif() diff --git a/source/source_cell/CMakeLists.txt b/source/source_cell/CMakeLists.txt index 202a29734f..5c687e778f 100644 --- a/source/source_cell/CMakeLists.txt +++ b/source/source_cell/CMakeLists.txt @@ -50,8 +50,8 @@ if(ENABLE_COVERAGE) endif() if(BUILD_TESTING) + add_subdirectory(test) if(ENABLE_MPI) - add_subdirectory(test) add_subdirectory(test_pw) endif() endif() diff --git a/source/source_cell/test/CMakeLists.txt b/source/source_cell/test/CMakeLists.txt index 8e845dd882..60a5b5f1a1 100644 --- a/source/source_cell/test/CMakeLists.txt +++ b/source/source_cell/test/CMakeLists.txt @@ -51,6 +51,10 @@ list(APPEND cell_simple_srcs add_library(cell_info OBJECT ${cell_simple_srcs}) +if(NOT ENABLE_MPI) + return() +endif() + AddTest( TARGET MODULE_CELL_read_pp LIBS base device diff --git a/source/source_io/CMakeLists.txt b/source/source_io/CMakeLists.txt index ae4435cd97..f215d68ff6 100644 --- a/source/source_io/CMakeLists.txt +++ b/source/source_io/CMakeLists.txt @@ -140,9 +140,9 @@ endif() if(BUILD_TESTING) add_subdirectory(module_parameter/test) + add_subdirectory(test_serial) if(ENABLE_MPI) add_subdirectory(test) - add_subdirectory(test_serial) endif() endif()