Skip to content

Commit

Permalink
Merge Pull Request trilinos#9092 from bartlettroscoe/Trilinos/8449-at…
Browse files Browse the repository at this point in the history
…dm-compiler-flags-fix

Automatically Merged using Trilinos Pull Request AutoTester
PR Title: Set non-cache vars for CMAKE_<LANG>_FLAGS with user override (trilinos#8449)
PR Author: bartlettroscoe
  • Loading branch information
trilinos-autotester authored May 5, 2021
2 parents 71a90c3 + 3dc3b50 commit f89b605
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
16 changes: 6 additions & 10 deletions cmake/std/atdm/ATDMDevEnvSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,12 @@ IF (ATDM_FPIC)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Build targets with position independent code")
ENDIF()

ATDM_SET_CACHE(CMAKE_C_FLAGS
"$ENV{ATDM_CONFIG_C_FLAGS} $ENV{EXTRA_C_FLAGS}" CACHE STRING)
ATDM_SET_CACHE(CMAKE_CXX_FLAGS
"$ENV{ATDM_CONFIG_CXX_FLAGS}${EXTRA_EXTRA_CXX_FLAGS} $ENV{EXTRA_CXX_FLAGS}" CACHE STRING)
ATDM_SET_CACHE(CMAKE_Fortran_FLAGS
"$ENV{ATDM_CONFIG_Fortran_FLAGS} $ENV{EXTRA_Fortran_FLAGS}" CACHE STRING)
# NOTE: That above "EXTRA_<LANG>_FLAGS" env vars are left in for backward
# compatibility with the EMPIRE configuration and are not directly set in any
# offical ATDM Trilinos configuration setup. Only the
# "ATDM_CONFIG_<LANG>_FLAGS" env vars are set.
SET(CMAKE_C_FLAGS
"$ENV{ATDM_CONFIG_C_FLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS
"$ENV{ATDM_CONFIG_CXX_FLAGS} ${EXTRA_EXTRA_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
SET(CMAKE_Fortran_FLAGS
"$ENV{ATDM_CONFIG_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS}")

IF (NOT "$ENV{ATDM_CONFIG_OPENMP_FORTRAN_FLAGS}" STREQUAL "")
ATDM_SET_CACHE(OpenMP_Fortran_FLAGS "$ENV{ATDM_CONFIG_OPENMP_FORTRAN_FLAGS}"
Expand Down
16 changes: 16 additions & 0 deletions cmake/std/atdm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ build locally as described below.

**Outline:**
* <a href="#quick-start">Quick-start</a>
* <a href="#setting-and-overridding-compiler-flags">Setting and overridding compiler flags</a>
* <a href="#parallel-build-and-test-processes">Parallel build and test processes</a>
* <a href="#installation-and-usage">Installation and usage</a>
* <a href="#checkin-test-atdmsh">checkin-test-atdm.sh</a>
Expand Down Expand Up @@ -414,6 +415,21 @@ where if the CMake cache variable `ATDM_INSTALLED_ENV_LOAD_SCRIPT_NAME` is not
specified, then it is given the name `load_matching_env.sh` by default.


## Setting and overridding compiler flags

Any selected configuration may set C, C++, and Fortran compiler flags by
internally setting the variables `CMAKE_C_FLAGS`, `CMAKE_CXX_FLAGS`, and
`CMAKE_Fortran_FLAGS`. However, the user can also append (and therefore
override) any of these compiler flags by configuring with the standard CMake
cache variables:

```
-D CMAKE_C_FLAGS="<extra_c_flags>"
-D CMAKE_CXX_FLAGS="<extra_cxx_flags>"
-D CMAKE_Fortran_FLAGS="<extra_fortran_flags>"
```


## Parallel build and test processes

By default, each system's `<system_name>/environment.sh` script automatically
Expand Down

0 comments on commit f89b605

Please sign in to comment.