2014-02-10 18:56:40 +00:00
|
|
|
##============================================================================
|
|
|
|
## Copyright (c) Kitware, Inc.
|
|
|
|
## All rights reserved.
|
|
|
|
## See LICENSE.txt for details.
|
|
|
|
## This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
## PURPOSE. See the above copyright notice for more information.
|
|
|
|
##
|
|
|
|
## Copyright 2014 Sandia Corporation.
|
|
|
|
## Copyright 2014 UT-Battelle, LLC.
|
2015-05-21 12:09:22 +00:00
|
|
|
## Copyright 2014 Los Alamos National Security.
|
2014-02-10 18:56:40 +00:00
|
|
|
##
|
|
|
|
## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
|
|
|
## the U.S. Government retains certain rights in this software.
|
|
|
|
##
|
|
|
|
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
|
|
|
## Laboratory (LANL), the U.S. Government retains certain rights in
|
|
|
|
## this software.
|
|
|
|
##============================================================================
|
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
|
|
set(CMAKE_COMPILER_IS_CLANGXX 1)
|
|
|
|
endif()
|
|
|
|
|
2015-08-10 16:33:46 +00:00
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI")
|
|
|
|
set(CMAKE_COMPILER_IS_PGIXX 1)
|
|
|
|
endif()
|
|
|
|
|
2015-08-26 12:56:42 +00:00
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
|
|
|
set(CMAKE_COMPILER_IS_ICCXX 1)
|
|
|
|
endif()
|
|
|
|
|
2014-02-10 18:56:40 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
|
|
|
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
|
|
|
# Standard warning flags we should always have
|
|
|
|
set(CMAKE_CXX_FLAGS_WARN " -Wall")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|
|
|
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CMAKE_CXX_FLAGS_WARN}")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG
|
|
|
|
"${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_WARN}")
|
|
|
|
|
|
|
|
# Addtional warnings for GCC
|
2015-05-25 12:24:47 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_WARN_EXTRA "-Wno-long-long -Wcast-align -Wconversion -Wchar-subscripts -Wextra -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused-parameter -fno-common")
|
2015-01-20 14:17:53 +00:00
|
|
|
if (VTKm_FORCE_ANSI)
|
2014-02-10 18:56:40 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_WARN_EXTRA "-ansi ${CMAKE_CXX_FLAGS_WARN_EXTRA}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Set up the debug CXX_FLAGS for extra warnings
|
2015-01-20 14:17:53 +00:00
|
|
|
option(VTKm_EXTRA_COMPILER_WARNINGS "Add compiler flags to do stricter checking when building debug." ON)
|
2014-02-10 18:56:40 +00:00
|
|
|
# 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 vtkm_declare_headers and vtkm_unit_tests CMake functions add these flags
|
|
|
|
# to their compiles. As long as the unit tests have good coverage, this
|
|
|
|
# should catch all problems.
|
2015-01-20 14:17:53 +00:00
|
|
|
if(VTKm_EXTRA_COMPILER_WARNINGS)
|
2014-02-10 18:56:40 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|
|
|
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CMAKE_CXX_FLAGS_WARN_EXTRA}")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG
|
|
|
|
"${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_WARN_EXTRA}")
|
|
|
|
endif()
|
2015-08-10 16:33:46 +00:00
|
|
|
elseif(CMAKE_COMPILER_IS_PGIXX)
|
|
|
|
#PGI and boost do not play well together when it comes to detected float128
|
|
|
|
#support. The primary issue is that Boost believes that PGI supports __float128
|
|
|
|
#because it is reporting itself as GCC, but it actually doesn't.
|
|
|
|
#our workaround for this is to manually explicitly disable float128
|
|
|
|
add_definitions("-DBOOST_MATH_DISABLE_FLOAT128=1")
|
2015-08-26 12:56:42 +00:00
|
|
|
elseif(CMAKE_COMPILER_IS_ICCXX)
|
|
|
|
#Intel compiler offers header level suppression in the form of
|
|
|
|
# #pragma warning(disable : 1478), but for warning 1478 it seems to not
|
|
|
|
#work. Instead we add it as a definition
|
|
|
|
add_definitions("-wd1478")
|
2014-02-10 18:56:40 +00:00
|
|
|
endif()
|
|
|
|
|