From 6de3bd8aede22c8dda93ba1147d3cfa97c9c8f02 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Wed, 26 Jun 2024 02:01:10 -0700 Subject: [PATCH 1/2] Include CTest for BUILD_TESTING option Allows skipping tests with -DBUILD_TESTING=OFF --- CMakeLists.txt | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e2ef2722ec21..491d236dd9010 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -379,11 +379,13 @@ set(DART_IN_SOURCE_BUILD TRUE) if(TARGET dart) # Add a "tests" target to build unit tests. - enable_testing() - if(MSVC) - add_subdirectory(tests) - else() - add_subdirectory(tests EXCLUDE_FROM_ALL) + include(CTest) + if (BUILD_TESTING) + if(MSVC) + add_subdirectory(tests) + else() + add_subdirectory(tests EXCLUDE_FROM_ALL) + endif() endif() # Add example subdirectories and an "examples" target. @@ -431,7 +433,10 @@ endif() add_subdirectory(python) # Add 'ALL' target that builds everything -set(all_target_candidates tests_and_run dartpy pytest) +set(all_target_candidates dartpy) +if (BUILD_TESTING) + set(all_target_candidates tests_and_run pytest) +endif() foreach(target_candidate ${all_target_candidates}) if(TARGET ${target_candidate}) list(APPEND all_targets ${target_candidate}) @@ -687,7 +692,9 @@ endif() #=============================================================================== message(STATUS "") message(STATUS "Run 'make' to build all the components") -message(STATUS "Run 'make tests' to build all the tests") +if (BUILD_TESTING) + message(STATUS "Run 'make tests' to build all the tests") +endif() message(STATUS "Run 'make examples' to build all the examples") message(STATUS "Run 'make tutorials' to build all the tutorials") message(STATUS "Run 'make view_docs' to see the API documentation") From b816c6892f1a4eb144c0cedeb7c4e4ef85fcd5db Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Wed, 26 Jun 2024 08:12:23 -0700 Subject: [PATCH 2/2] Update CMakeLists.txt Co-authored-by: Jeongseok (JS) Lee Signed-off-by: Steve Peters --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 491d236dd9010..0b57e6c501612 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -435,7 +435,7 @@ add_subdirectory(python) # Add 'ALL' target that builds everything set(all_target_candidates dartpy) if (BUILD_TESTING) - set(all_target_candidates tests_and_run pytest) + list(APPEND all_target_candidates tests_and_run pytest) endif() foreach(target_candidate ${all_target_candidates}) if(TARGET ${target_candidate})