cmake: add a vtkm_option macro

Projects might want to force these without giving users the indication
that their choices actually matter.
This commit is contained in:
Ben Boeckel 2018-01-16 14:54:31 -05:00
parent 022f12b2ec
commit c5d630a77e
3 changed files with 24 additions and 15 deletions

@ -64,7 +64,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
endif() endif()
# Set up the debug CXX_FLAGS for extra warnings # Set up the debug CXX_FLAGS for extra warnings
option(VTKm_EXTRA_COMPILER_WARNINGS "Add compiler flags to do stricter checking when building debug." ON) vtkm_option(VTKm_EXTRA_COMPILER_WARNINGS "Add compiler flags to do stricter checking when building debug." ON)
# We used to add the compiler flags globally, but this caused problems with # We used to add the compiler flags globally, but this caused problems with
# the CUDA compiler (and its lack of support for GCC pragmas). Instead, # the CUDA compiler (and its lack of support for GCC pragmas). Instead,
# the vtkm_declare_headers and vtkm_unit_tests CMake functions add these flags # the vtkm_declare_headers and vtkm_unit_tests CMake functions add these flags

@ -896,3 +896,12 @@ function(_vtkm_parse_test_options varname options)
endforeach() endforeach()
set(${varname} ${names} PARENT_SCOPE) set(${varname} ${names} PARENT_SCOPE)
endfunction() endfunction()
# -----------------------------------------------------------------------------
# vtkm_option(variable doc [initial])
# Provides an option if it is not already defined.
macro (vtkm_option variable)
if (NOT DEFINED "${variable}")
option("${variable}" ${ARGN})
endif ()
endmacro ()

@ -102,7 +102,7 @@ set(CMAKE_CXX_EXTENSIONS False)
# We prefer to only export symbols of a small set of user facing classes, # We prefer to only export symbols of a small set of user facing classes,
# rather than exporting all symbols. In practice we will try to not export # rather than exporting all symbols. In practice we will try to not export
# symbols for any third party library. # symbols for any third party library.
option(VTKm_USE_DEFAULT_SYMBOL_VISIBILITY "Don't explicitly hide symbols from libraries." OFF) vtkm_option(VTKm_USE_DEFAULT_SYMBOL_VISIBILITY "Don't explicitly hide symbols from libraries." OFF)
mark_as_advanced(VTKm_USE_DEFAULT_SYMBOL_VISIBILITY) mark_as_advanced(VTKm_USE_DEFAULT_SYMBOL_VISIBILITY)
if(NOT VTKm_USE_DEFAULT_SYMBOL_VISIBILITY) if(NOT VTKm_USE_DEFAULT_SYMBOL_VISIBILITY)
set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden)
@ -113,27 +113,27 @@ include(CMake/VTKmCompilerExtras.cmake)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Configurable Options # Configurable Options
option(VTKm_ENABLE_CUDA "Enable Cuda support" OFF) vtkm_option(VTKm_ENABLE_CUDA "Enable Cuda support" OFF)
option(VTKm_ENABLE_TBB "Enable TBB support" OFF) vtkm_option(VTKm_ENABLE_TBB "Enable TBB support" OFF)
option(VTKm_ENABLE_RENDERING "Enable rendering library" ON) vtkm_option(VTKm_ENABLE_RENDERING "Enable rendering library" ON)
option(VTKm_ENABLE_TESTING "Enable VTKm Testing" ON) vtkm_option(VTKm_ENABLE_TESTING "Enable VTKm Testing" ON)
option(VTKm_ENABLE_BENCHMARKS "Enable VTKm Benchmarking" OFF) vtkm_option(VTKm_ENABLE_BENCHMARKS "Enable VTKm Benchmarking" OFF)
option(VTKm_ENABLE_OSMESA "Enable creating the OSMesa canvas" OFF) vtkm_option(VTKm_ENABLE_OSMESA "Enable creating the OSMesa canvas" OFF)
option(VTKm_ENABLE_MPI "Enable MPI support" OFF) vtkm_option(VTKm_ENABLE_MPI "Enable MPI support" OFF)
option(VTKm_ENABLE_DOCUMENTATION "Build Doxygen documentation" OFF) vtkm_option(VTKm_ENABLE_DOCUMENTATION "Build Doxygen documentation" OFF)
option(VTKm_ENABLE_EXAMPLES "Build examples" OFF) vtkm_option(VTKm_ENABLE_EXAMPLES "Build examples" OFF)
option(VTKm_USE_DOUBLE_PRECISION vtkm_option(VTKm_USE_DOUBLE_PRECISION
"Use double precision for floating point calculations" "Use double precision for floating point calculations"
OFF OFF
) )
option(VTKm_USE_64BIT_IDS "Use 64-bit indices." ON) vtkm_option(VTKm_USE_64BIT_IDS "Use 64-bit indices." ON)
option(VTKm_NO_ASSERT "Disable assertions in debugging builds." OFF) vtkm_option(VTKm_NO_ASSERT "Disable assertions in debugging builds." OFF)
mark_as_advanced(VTKm_NO_ASSERT) mark_as_advanced(VTKm_NO_ASSERT)
option(BUILD_SHARED_LIBS "Build VTK-m with shared libraries" ON) vtkm_option(BUILD_SHARED_LIBS "Build VTK-m with shared libraries" ON)
set(VTKm_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) set(VTKm_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
if (VTKm_ENABLE_TESTING) if (VTKm_ENABLE_TESTING)