From 8b6246a68d0f6b0e8c7f5369c2f5bfbbc16a7457 Mon Sep 17 00:00:00 2001 From: Sean Bryan Date: Fri, 8 Mar 2024 12:58:13 +1100 Subject: [PATCH] Clarify setting compiler flags in CMakeLists.txt --- CMakeLists.txt | 12 ++++++------ .../developer_guide/other_resources/build_system.md | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5498583f5..e70513f45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,15 +15,15 @@ endif() find_package(PkgConfig REQUIRED) pkg_check_modules(NETCDF REQUIRED IMPORTED_TARGET "netcdf-fortran") -set(CABLE_INTEL_Fortran_FLAGS -fp-model precise) -set(CABLE_INTEL_Fortran_FLAGS_DEBUG -O0 -g -traceback -fpe0) -set(CABLE_INTEL_Fortran_FLAGS_RELEASE -O2) +set(CABLE_Intel_Fortran_FLAGS -fp-model precise) +set(CABLE_Intel_Fortran_FLAGS_DEBUG -O0 -g -traceback -fpe0) +set(CABLE_Intel_Fortran_FLAGS_RELEASE -O2) if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") set( CABLE_Fortran_FLAGS - ${CABLE_INTEL_Fortran_FLAGS} - "$<$:${CABLE_INTEL_Fortran_FLAGS_RELEASE}>" - "$<$:${CABLE_INTEL_Fortran_FLAGS_DEBUG}>" + ${CABLE_Intel_Fortran_FLAGS} + "$<$:${CABLE_Intel_Fortran_FLAGS_RELEASE}>" + "$<$:${CABLE_Intel_Fortran_FLAGS_DEBUG}>" ) endif() diff --git a/documentation/docs/developer_guide/other_resources/build_system.md b/documentation/docs/developer_guide/other_resources/build_system.md index a637a8d60..473fca61a 100644 --- a/documentation/docs/developer_guide/other_resources/build_system.md +++ b/documentation/docs/developer_guide/other_resources/build_system.md @@ -11,7 +11,7 @@ Source files can be added easily by adding to the list of source files in [CMake ## Setting compiler flags -The recommended compiler flags for debug and release builds are set in the [CMakeLists.txt][CMakeLists.txt] file via [`target_compile_options`](https://cmake.org/cmake/help/latest/command/target_compile_options.html). These can be modified if required. +The recommended compiler flags for debug and release builds for each compiler are set in the [CMakeLists.txt][CMakeLists.txt] file via the `CABLE__Fortran_FLAGS*` variables. These can be modified if required. ???+ warning Compiler flags should be guarded by a check on the compiler ID as they are generally compiler specific. See [`CMAKE__COMPILER_ID`](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html) for a list of supported compiler IDs.