forked from ESCOMP/CTSM
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit Added SetBuildOptions.cmake (PR ESCOMP#2) 'b61d7108a2f36…
…5eb050a094d971c0f0a60a1a6e7' into eclm
- Loading branch information
Showing
5 changed files
with
77 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# This module sets the required compile flags and definitions for all targets. | ||
|
||
if(UNIX AND NOT APPLE) | ||
add_compile_definitions(LINUX) | ||
endif() | ||
|
||
# Set default build = RELEASE if none was specified. | ||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "Choose the type of build." FORCE) | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "DEBUG" "RELEASE") | ||
endif() | ||
|
||
# Set default compiler = GNU if none was specified. | ||
if(NOT COMPILER) | ||
set(COMPILER "GNU" CACHE STRING "Choose compiler toolchain." FORCE) | ||
set_property(CACHE COMPILER PROPERTY STRINGS "GNU" "Intel") | ||
endif() | ||
|
||
if(COMPILER STREQUAL "GNU") | ||
add_compile_definitions(CPRGNU) | ||
set(CMAKE_C_FLAGS "-std=gnu99") | ||
set(CMAKE_C_FLAGS_DEBUG "-fcheck=bounds") | ||
set(CMAKE_C_FLAGS_RELEASE "-O") | ||
set(CMAKE_Fortran_FLAGS "-fconvert=big-endian -ffree-line-length-none -ffixed-line-length-none -ffree-form") | ||
set(CMAKE_Fortran_FLAGS_DEBUG "-g -Wall -Og -fbacktrace -ffpe-trap=zero,overflow -fcheck=bounds") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O") | ||
elseif(COMPILER STREQUAL "Intel") | ||
add_compile_definitions(CPRINTEL) | ||
set(CMAKE_C_FLAGS "-qno-opt-dynamic-align -std=gnu99 -fp-model precise") | ||
set(CMAKE_C_FLAGS_DEBUG "-O0 -g") | ||
set(CMAKE_C_FLAGS_RELEASE "-O2 -debug minimal") | ||
set(CMAKE_Fortran_FLAGS "-free -qno-opt-dynamic-align -ftz -traceback -convert big_endian -assume byterecl -assume realloc_lhs -fp-model source") | ||
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal") | ||
else() | ||
message(FATAL_ERROR "COMPILER='${COMPILER}' is not supported.") | ||
endif() | ||
|
||
message(STATUS " ******* ${CMAKE_PROJECT_NAME} build options ******* ") | ||
message(STATUS " Build type = '${CMAKE_BUILD_TYPE}'") | ||
message(STATUS " Compiler = '${COMPILER}'") | ||
message(STATUS " *************************************** ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters