From 566c28a560a736ebaff1fa92eeb40e5cbcfc9e48 Mon Sep 17 00:00:00 2001 From: Oliver Heidmann <oliver.heidmann@mpimet.mpg.de> Date: Fri, 21 Feb 2025 12:19:28 +0100 Subject: [PATCH] added config features file, added Fortran as compiler to CMake --- CMakeLists.txt | 6 +++++- cmake/cdo_config_features.h.in | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 cmake/cdo_config_features.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b8536bc4..bfad1b261 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required( VERSION 3.30 FATAL_ERROR ) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -project( cdo VERSION 2.4.0 LANGUAGES C CXX ) +project( cdo VERSION 2.4.0 LANGUAGES C CXX Fortran) # --- Additional functionalities for CMake include(CTest) @@ -17,6 +17,10 @@ configure_file ( "${PROJECT_SOURCE_DIR}/cmake/cdo_config.h.in" "${PROJECT_BINARY_DIR}/src/config.h" ) +configure_file ( + "${PROJECT_SOURCE_DIR}/cmake/cdo_config_features.h.in" + "${PROJECT_BINARY_DIR}/src/cdo_config_features.h" +) # --- Other compile definitions currently required TEMP list(APPEND cdo_compile_definitions restrict= diff --git a/cmake/cdo_config_features.h.in b/cmake/cdo_config_features.h.in new file mode 100644 index 000000000..6de4ba707 --- /dev/null +++ b/cmake/cdo_config_features.h.in @@ -0,0 +1,16 @@ +#ifndef CDO_CONFIG_FEATURES_H +#define CDO_CONFIG_FEATURES_H + +#include <string_view> + +/* clang-format off */ +constexpr std::string_view CDO = "@PROJECT_NAME@"; +constexpr std::string_view CXX_VERSION = "@CMAKE_CXX_COMPILER_VERSION@"l +constexpr std::string_view CXX_COMPILER = "@CMAKE_CXX_COMPILER_ID@"; +constexpr std::string_view C_VERSION = "@CMAKE_C_COMPILER_VERSION@"; +constexpr std::string_view C_COMPILER = "@CMAKE_C_COMPILER_ID@"; +constexpr std::string_view F77_COMPILER = "@CMAKE_Fortran_COMPILER_ID@"; +constexpr std::string_view F77_VERSION = "@CMAKE_Fortran_COMPILER_VERSION@"; +/* clang-format on */ + +#endif -- GitLab