Merge topic 'cxx-flags-in-package-config'
13534a06 Drop cxx_constexpr from target compile features 9f0bd788 Add C++11 flags to sub-projects Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !568
This commit is contained in:
commit
9acccf44f6
@ -107,9 +107,15 @@ macro(vtkm_configure_component_Base)
|
||||
include(VTKmCompilerOptimizations)
|
||||
endif()
|
||||
|
||||
# Check for the existance of the base vtkm target
|
||||
if (TARGET vtkm)
|
||||
set(VTKm_base_vtkm_target_FOUND True)
|
||||
endif()
|
||||
|
||||
vtkm_finish_configure_component(Base
|
||||
DEPENDENT_VARIABLES Boost_FOUND
|
||||
DEPENDENT_VARIABLES Boost_FOUND VTKm_base_vtkm_target_FOUND
|
||||
ADD_INCLUDES ${Boost_INCLUDE_DIRS}
|
||||
ADD_LIBRARIES vtkm
|
||||
)
|
||||
endmacro()
|
||||
|
||||
|
@ -584,7 +584,6 @@ function(vtkm_wrap_sources_for_cuda cuda_source_list_var)
|
||||
set(${cuda_source_list_var} ${cuda_sources} PARENT_SCOPE)
|
||||
endfunction(vtkm_wrap_sources_for_cuda)
|
||||
|
||||
set(VTKM_HAS_AT_LEAST_ONE_LIBRARY FALSE CACHE INTERNAL "" FORCE)
|
||||
# Add a VTK-m library. The name of the library will match the "kit" name
|
||||
# (e.g. vtkm_rendering) unless the NAME argument is given.
|
||||
#
|
||||
@ -676,7 +675,6 @@ function(vtkm_library)
|
||||
vtkm_install_headers("${dir_prefix}"
|
||||
${CMAKE_BINARY_DIR}/${VTKm_INSTALL_INCLUDE_DIR}/${dir_prefix}/${lib_name}_export.h
|
||||
)
|
||||
set(VTKM_HAS_AT_LEAST_ONE_LIBRARY TRUE CACHE INTERNAL "" FORCE)
|
||||
endfunction(vtkm_library)
|
||||
|
||||
# The Thrust project is not as careful as the VTKm project in avoiding warnings
|
||||
|
@ -53,6 +53,17 @@ set(VTKm_INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
# Create an "interface" target library. This is not a real library but rather
|
||||
# holds CMake configuration that is required for CXX targets that use VTK-m
|
||||
# headers. In particular, it makes sure the appropriate C++11 version is being
|
||||
# used. (The cxx_constexpr and cxx_auto_type features happen to force C++11.
|
||||
# Directly asking for C++11 with this interface is not supported in CMake 3.3.)
|
||||
# This is also exported so that dependent CMake projects can load the same
|
||||
# configuration.
|
||||
add_library(vtkm INTERFACE)
|
||||
target_compile_features(vtkm INTERFACE cxx_auto_type)
|
||||
install(TARGETS vtkm EXPORT ${VTKm_EXPORT_NAME})
|
||||
|
||||
# Load the base VTK-m configuration, which is required for some of the later
|
||||
# config.
|
||||
vtkm_configure_component_Base()
|
||||
@ -61,13 +72,9 @@ if(NOT VTKm_Base_FOUND)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add flag to enable C++11 support.
|
||||
# Unless the user has explicitly stated to compile with a different standard
|
||||
if (NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
# When using C++11 suport make sure you use the standard C++ extensions rather
|
||||
# than compiler-specific versions of the extensions (to preserve portability).
|
||||
set(CMAKE_CXX_EXTENSIONS False)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add supplemental compiler warnings, and GCC visibility support.
|
||||
@ -318,7 +325,6 @@ install(
|
||||
)
|
||||
|
||||
# Create and install exports for external projects
|
||||
if(${VTKM_HAS_AT_LEAST_ONE_LIBRARY})
|
||||
export(EXPORT ${VTKm_EXPORT_NAME}
|
||||
FILE ${CMAKE_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmTargets.cmake
|
||||
)
|
||||
@ -326,14 +332,6 @@ if(${VTKM_HAS_AT_LEAST_ONE_LIBRARY})
|
||||
DESTINATION ${VTKm_INSTALL_LIB_DIR}
|
||||
FILE VTKmTargets.cmake
|
||||
)
|
||||
else() # No libraries built
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmTargets.cmake
|
||||
"# This build of VTK-m has no libraries to export targets for"
|
||||
)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmTargets.cmake
|
||||
DESTINATION ${VTKm_INSTALL_LIB_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Enable CPack packaging
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE ${VTKm_SOURCE_DIR}/README.md)
|
||||
|
Loading…
Reference in New Issue
Block a user