Files
lapack/CMAKE/CheckTimeFunction.cmake
T
Ben Boeckel dd0b532f60 cmake: forward the macOS deployment target to the TIME function test
When using newer Xcode releases, older `gfortran` may be given a
deployment target that is not understood if the host is on a new enough
version. Forward the deployment target from the main project to the
testing project to check with similar settings as the main project.
2021-12-10 21:45:12 -05:00

31 lines
1.0 KiB
CMake

# - Check if the Fortran function exists.
# CHECK_TIME_FUNCTION(FUNCTION VARIABLE TYPE)
# - macro which checks if the Fortran function exists
# FUNCTION - the name of the Fortran function
# VARIABLE - variable to store the result
#
macro(CHECK_TIME_FUNCTION FUNCTION VARIABLE)
try_compile(RES
${PROJECT_BINARY_DIR}/INSTALL
${PROJECT_SOURCE_DIR}/INSTALL
TIMING secondtst_${FUNCTION}
CMAKE_FLAGS
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}
OUTPUT_VARIABLE OUTPUT)
if(RES)
set(${VARIABLE} ${FUNCTION} CACHE INTERNAL "Have Fortran function ${FUNCTION}")
message(STATUS "Looking for Fortran ${FUNCTION} - found")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Fortran ${FUNCTION} exists. ${OUTPUT} \n\n")
else()
message(STATUS "Looking for Fortran ${FUNCTION} - not found")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Fortran ${FUNCTION} does not exist. \n ${OUTPUT} \n")
endif()
endmacro()