diff --git a/CMakeLists.txt b/CMakeLists.txt index c5d13a5c0f3..b789c634d93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,7 +246,7 @@ endif() if(GINKGO_BUILD_BENCHMARKS) find_package(gflags 2.2.2 QUIET) endif() -if(GINKGO_BUILD_TESTS OR GINKGO_BUILD_BENCHMARKS) +if(GINKGO_BUILD_TESTS OR GINKGO_BUILD_BENCHMARKS OR GINKGO_BUILD_EXAMPLES) find_package(nlohmann_json 3.9.1 QUIET) endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 90c1f8e2632..5d8b9d9aa22 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -110,16 +110,15 @@ if(GINKGO_BUILD_TESTS) foreach(config IN LISTS config_list) get_filename_component(config_name "${config}" NAME_WE) foreach(executor IN LISTS executors) - add_test(NAME example_file-config-solver_${config_name}_${executor} - COMMAND - "$" - "${executor}" "${CMAKE_CURRENT_SOURCE_DIR}/file-config-solver/config/${config_name}.json" - "${CMAKE_CURRENT_SOURCE_DIR}/file-config-solver/data/A.mtx" - WORKING_DIRECTORY - "$") + add_test(NAME example_file-config-solver_${config_name}_${executor} + COMMAND + "$" + "${executor}" "${CMAKE_CURRENT_SOURCE_DIR}/file-config-solver/config/${config_name}.json" + "${CMAKE_CURRENT_SOURCE_DIR}/file-config-solver/data/A.mtx" + WORKING_DIRECTORY + "$") # Prevent performance issues with high core counts set_property(TEST example_file-config-solver_${config_name}_${executor} PROPERTY ENVIRONMENT OMP_NUM_THREADS=4) - endforeach() + endforeach() endforeach() - endif() diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index cfba7759170..1977d8e7f68 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -13,7 +13,7 @@ if(GINKGO_BUILD_BENCHMARKS) endif() endif() -if(GINKGO_BUILD_TESTS OR GINKGO_BUILD_BENCHMARKS) +if(GINKGO_BUILD_TESTS OR GINKGO_BUILD_BENCHMARKS OR GINKGO_BUILD_EXAMPLES) if (NOT nlohmann_json_FOUND) add_subdirectory(nlohmann_json) endif()