cmake: avoid adding testing directories if testing is disabled

Some testing directories have side effects such as installing headers or
compiling code that ultimately doesn't end up getting used.
This commit is contained in:
Ben Boeckel 2021-06-01 18:38:19 -04:00
parent 0282a875eb
commit 4c7fe13a98
27 changed files with 60 additions and 30 deletions

@ -112,10 +112,6 @@ endfunction()
# backends at runtime.
#
function(vtkm_unit_tests)
if (NOT VTKm_ENABLE_TESTING)
return()
endif()
set(options)
set(global_options ${options} USE_VTKM_JOB_POOL MPI ALL_BACKENDS)
set(oneValueArgs BACKEND NAME LABEL)

@ -89,7 +89,9 @@ endif()
add_subdirectory(thirdparty/optionparser)
add_subdirectory(thirdparty/lcl)
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()
add_subdirectory(internal)
#-----------------------------------------------------------------------------

@ -311,4 +311,6 @@ if(TARGET vtkm_loguru)
endif()
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -42,4 +42,6 @@ vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -19,7 +19,7 @@ add_subdirectory(internal)
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if (TARGET vtkm::cuda)
if (TARGET vtkm::cuda AND VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif()

@ -52,4 +52,6 @@ vtkm_declare_headers(${headers})
# internal and which are part of the external interface.
#add_custom_target(vtkmContInternal ALL DEPENDS vtkmCont)
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -17,6 +17,6 @@ add_subdirectory(internal)
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if (TARGET vtkm::kokkos)
if (TARGET vtkm::kokkos AND VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif()

@ -17,6 +17,6 @@ add_subdirectory(internal)
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if (TARGET vtkm::openmp)
if (TARGET vtkm::openmp AND VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif()

@ -17,4 +17,6 @@ add_subdirectory(internal)
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -17,6 +17,6 @@ add_subdirectory(internal)
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if (TARGET vtkm::tbb)
if (TARGET vtkm::tbb AND VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif()

@ -63,4 +63,6 @@ add_subdirectory(cuda)
add_subdirectory(kokkos)
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -49,4 +49,6 @@ vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -25,6 +25,6 @@ set_source_files_properties(ThrustPatches.h
PROPERTIES VTKm_CANT_BE_HEADER_TESTED TRUE)
#-----------------------------------------------------------------------------
if (TARGET vtkm::cuda)
if (TARGET vtkm::cuda AND VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif()

@ -22,4 +22,6 @@ vtkm_declare_headers(${headers})
vtkm_pyexpander_generated_file(WorkletInvokeFunctorDetail.h)
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -15,6 +15,6 @@ set(headers
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_OPENMP)
if (VTKm_ENABLE_OPENMP AND VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif()

@ -15,4 +15,6 @@ set(headers
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -15,6 +15,6 @@ set(headers
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if (TARGET vtkm::tbb)
if (TARGET vtkm::tbb AND VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif()

@ -278,4 +278,6 @@ add_subdirectory(internal)
add_subdirectory(particleadvection)
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -88,4 +88,6 @@ vtkm_pyexpander_generated_file(FunctionInterfaceDetailPost.h)
vtkm_pyexpander_generated_file(VariantImplDetail.h)
vtkm_pyexpander_generated_file(VecOperators.h)
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -17,6 +17,6 @@ vtkm_declare_headers(${headers})
add_subdirectory(internal)
if(VTKm_ENABLE_OPENGL_TESTS)
if(VTKm_ENABLE_OPENGL_TESTS AND VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif()

@ -18,6 +18,6 @@ set(headers
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if(TARGET vtkm_rendering)
if(TARGET vtkm_rendering AND VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif()

@ -98,4 +98,6 @@ endif()
add_subdirectory(internal)
add_subdirectory(reader)
add_subdirectory(writer)
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -14,4 +14,6 @@ set(headers
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -155,4 +155,6 @@ endif()
#-----------------------------------------------------------------------------
add_subdirectory(internal)
add_subdirectory(raytracing)
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -30,4 +30,6 @@ vtkm_library(NAME vtkm_source
target_link_libraries(vtkm_source PUBLIC vtkm_cont)
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -158,4 +158,6 @@ target_link_libraries(vtkm_worklet PUBLIC vtkm_cont)
set_source_files_properties(${sources_device} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -19,4 +19,6 @@ set(headers
vtkm_declare_headers(${headers})
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()