vtk-m/CMake/VTKmCompilerExtras.cmake
Robert Maynard 78cef0c33d Suppress deprecation warnings about glut as we investigate our options.
Starting in OSX 10.9, apple has deprecated the glut.h provided header
so we need to figure out how we want to do window management on OSX. I expect
the way forward is to require the developer to install openGLUT.
2015-08-27 09:37:13 -04:00

76 lines
3.1 KiB
CMake

##============================================================================
## 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.
## Copyright 2014 Los Alamos National Security.
##
## 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()
if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI")
set(CMAKE_COMPILER_IS_PGIXX 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_COMPILER_IS_ICCXX 1)
endif()
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
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")
if (VTKm_FORCE_ANSI)
set(CMAKE_CXX_FLAGS_WARN_EXTRA "-ansi ${CMAKE_CXX_FLAGS_WARN_EXTRA}")
endif()
# 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)
# 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.
if(VTKm_EXTRA_COMPILER_WARNINGS)
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()
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")
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")
endif()