Skip to content

Commit 601d70e

Browse files
committed
Added some Intel & GNU check, warning and traceback flags
1 parent 0505f7e commit 601d70e

File tree

3 files changed

+52
-4
lines changed

3 files changed

+52
-4
lines changed

CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# CMake Configuration and build added by Izaak Beekman -- April, 2014
1+
# CMake Configuration and build added by Izaak Beekman -- May, 2014
22
#
33
# Copy right (c) 2014, Izaak Beekman
44
# All rights reserved.
@@ -11,10 +11,15 @@
1111

1212
cmake_minimum_required ( VERSION 2.8 FATAL_ERROR )
1313

14-
#include ( cmake/OutOfSourceCheck.cmake ) # default to out of source builds
15-
#include ( cmake/BuildSettings.cmake ) # Release, RelWithDebInfo, etc.
14+
# Set the type/configuration of build to perform
15+
set ( CMAKE_CONFIGURATION_TYPES "Debug" "Release" "MinSizeRel" "RelWithDebInfo" )
16+
set ( CMAKE_BUILD_TYPE "Release"
17+
CACHE STRING "Select which configuration to build." )
18+
set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
19+
20+
1621
enable_language ( Fortran )
17-
#include ( cmake/CompilerCompatibilityCheck.cmake )
22+
include ( cmake/pickFortranCompilerFlags.cmake )
1823

1924
# Check for in-source builds and error out if found
2025
# Provides an advanced option to allow in source builds
@@ -65,6 +70,11 @@ set_target_properties ( ${LIB_NAME}
6570
PROPERTIES
6671
SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR} )
6772

73+
#---------------------------------------------------------------------
74+
# Add some tests to ensure that the software is performing as expected
75+
#---------------------------------------------------------------------
76+
77+
6878
#-------------------------------------
6979
# Define where our files get installed
7080
#-------------------------------------

cmake/pickFortranCompilerFlags.cmake

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
if ( NOT Fortran_FLAGS_INIT )
2+
set ( Fortran_FLAGS_INIT TRUE )
3+
set ( CALL_STACK_BACK_TRACE TRUE CACHE BOOL
4+
"Enable backtraces on unexpected runtime errors? (Recommended)" )
5+
set ( ENABLE_COMPILE_TIME_WARNINGS TRUE CACHE BOOL
6+
"Enable diagnostic warnings at compile time? (Recommended)" )
7+
set ( ENABLE_RUNTIME_CHECKS FALSE CACHE BOOL
8+
"Enable compiler run-time checks? (Enabling this will turn off most compiler optimizations.)" )
9+
mark_as_advanced ( ENABLE_RUNTIME_CHECKS )
10+
11+
if ( "${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel" )
12+
if ( CALL_STACK_BACK_TRACE )
13+
add_compile_options ( -traceback )
14+
endif ( CALL_STACK_BACK_TRACE )
15+
if ( ENABLE_COMPILE_TIME_WARNINGS )
16+
# The following warning might be triggered by ifort unless explicitly silenced:
17+
# warning #7601: F2008 standard does not allow an internal procedure to be an actual argument procedure
18+
# name. (R1214.4). In the context of F2008 this is an erroneous warning.
19+
# See https://prd1idz.cps.intel.com/en-us/forums/topic/486629
20+
add_compile_options ( -warn -stand f08 -diag-disable 7601 )
21+
endif ( ENABLE_COMPILE_TIME_WARNINGS )
22+
if ( ENABLE_RUNTIME_CHECKS )
23+
add_compile_options ( -check all )
24+
endif ( ENABLE_RUNTIME_CHECKS )
25+
elseif ( "{CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU" )
26+
if ( CALL_STACK_BACK_TRACE )
27+
add_compile_options ( -fbacktrace )
28+
endif ( CALL_STACK_BACK_TRACE )
29+
if ( ENABLE_COMPILETIME_CHECKS )
30+
add_compile_options ( -Wall -Wextra -Wno-maybe-uninitialized -pedantic -std=f2008 )
31+
endif ( ENABLE_COMPILETIME_CHECKS )
32+
if ( ENABLE_RUNTIME_CHECKS )
33+
add_compile_options ( -fcheck=all )
34+
endif ( ENABLE_RUNTIME_CHECKS )
35+
endif ( "${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel" )
36+
endif ( NOT Fortran_FLAGS_INIT )

cmake/uninstall.cmake.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Adapted from http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F May 1, 2014
2+
13
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
24
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
35
endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")

0 commit comments

Comments
 (0)