Skip to content

Commit

Permalink
Allow overriding of precision check in CMake (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
awvwgk authored Aug 28, 2024
1 parent 0ab6337 commit 482fc75
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,24 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
endif()

include(CheckFortranSourceCompiles)
check_fortran_source_compiles(
"integer, parameter :: qp = selected_real_kind(33); complex(qp) :: x; end"
WITH_QP
)
set(WITH_QP ${WITH_QP} PARENT_SCOPE)
check_fortran_source_compiles(
"
integer, parameter :: xdp = merge(-1, selected_real_kind(18), selected_real_kind(18) == selected_real_kind(33))
complex(xdp) :: x
end
"
WITH_XDP
)
set(WITH_XDP ${WITH_XDP} PARENT_SCOPE)
if(NOT DEFINED WITH_QP)
check_fortran_source_compiles(
"integer, parameter :: qp = selected_real_kind(33); complex(qp) :: x; end"
WITH_QP
)
set(WITH_QP ${WITH_QP} PARENT_SCOPE)
endif()
if(NOT DEFINED WITH_XDP)
check_fortran_source_compiles(
"
integer, parameter :: xdp = merge(-1, selected_real_kind(18), selected_real_kind(18) == selected_real_kind(33))
complex(xdp) :: x
end
"
WITH_XDP
)
set(WITH_XDP ${WITH_XDP} PARENT_SCOPE)
endif()

include(CMakePackageConfigHelpers)
configure_package_config_file(
Expand Down

0 comments on commit 482fc75

Please sign in to comment.