Commit 4e991918 authored by Martin Köhler's avatar Martin Köhler
Browse files

Initial commit

parents
This diff is collapsed.
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
IF(CMAKE_C_COMPILER_ID STREQUAL "GNU")
# GNU
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wunused -g ")
IF(INTEGER8 STREQUAL ON)
ADD_DEFINITIONS(-DINTEGER8)
ENDIF()
IF(HOSTOPT STREQUAL ON)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mtune=native")
ENDIF()
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "Intel")
# Intel
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -w2 -g")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
IF(INTEGER8 STREQUAL ON)
ADD_DEFINITIONS(-DINTEGER8)
ENDIF()
IF(HOSTOPT STREQUAL ON)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -xHost")
ENDIF()
ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
# PGI
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O4 ")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -Minfo=all")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fpic")
IF(INTEGER8 STREQUAL ON)
ADD_DEFINITIONS(-DINTEGER8)
ENDIF()
ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "XL")
# IBM XL
IF(HOSTOPT STREQUAL ON)
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O5 -qtune=auto -qarch=auto")
ELSE()
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
ENDIF()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qpic")
STRING(REPLACE "-qhalt=e" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
IF(INTEGER8 STREQUAL ON)
ADD_DEFINITIONS(-DINTEGER8)
ENDIF()
IF(OPENMP_FOUND)
LIST(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_LIBRARIES "xlomp_ser")
ENDIF()
ENDIF()
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Do NOT include this module directly into any of your code. It is meant as
# a library for Check*CompilerFlag.cmake modules. It's content may change in
# any way between releases.
#
# --------------------------------------------------------
# THIS IS A REPLACEMENT IF THE CMAKE VERSION IS TOO OLD
# WE USE THIS MODULE.
# --------------------------------------------------------
MACRO(CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
SET(${_VAR}
FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG
FAIL_REGEX "unknown .*option" # Clang
FAIL_REGEX "optimization flag .* not supported" # Clang
FAIL_REGEX "unknown argument ignored" # Clang (cl)
FAIL_REGEX "ignoring unknown option" # MSVC, Intel
FAIL_REGEX "warning D9002" # MSVC, any lang
FAIL_REGEX "option.*not supported" # Intel
FAIL_REGEX "invalid argument .*option" # Intel
FAIL_REGEX "ignoring option .*argument required" # Intel
FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel
FAIL_REGEX "[Uu]nknown option" # HP
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
FAIL_REGEX "command option .* is not recognized" # XL
FAIL_REGEX "command option .* contains an incorrect subargument" # XL
FAIL_REGEX "not supported in this configuration. ignored" # AIX
FAIL_REGEX "File with unknown suffix passed to linker" # PGI
FAIL_REGEX "[Uu]nknown switch" # PGI
FAIL_REGEX "WARNING: unknown flag:" # Open64
FAIL_REGEX "Incorrect command line option:" # Borland
FAIL_REGEX "Warning: illegal option" # SunStudio 12
FAIL_REGEX "[Ww]arning: Invalid suboption" # Fujitsu
)
ENDMACRO()
# This module defines some useful macros/functions for
# CMake.
#
# Changelog:
# - Aug 18, 2017 Maximilian Behr
## ------- FUNCTION CheckHasModule -----
# include the module CheckCCompilerFlag
INCLUDE(CheckCCompilerFlag)
INCLUDE(CheckCXXCompilerFlag)
IF(${CMAKE_VERSION} VERSION_LESS "3.0.0")
INCLUDE(CheckFortranCompilerFlag_old)
ELSE()
INCLUDE(CheckFortranCompilerFlag_old)
ENDIF()
# ------- FUNCTION ADD --------
#
# Add a value to a variable.
#
# Usage:
# Instead of:
# SET(MYVAR ${MYVAR} VALUE1 VALUE2 ...)
# Use:
# ADD(MYVAR VALUE1 VALUE2 VALUE3)
#
#
FUNCTION(ADD VAR)
SET(ARGS "${ARGN}")
FOREACH(ARG IN LISTS ARGS)
#update variable with new values
SET(${VAR} ${${VAR}} ${ARG})
ENDFOREACH()
# make variable available in parent scope
SET(${VAR} ${${VAR}} PARENT_SCOPE)
ENDFUNCTION()
## ------- FUNCTION SHOW_ALL_VARIABLES --------
# Show all variables.
#
# Usage:
# SHOW_ALL_VARIABLES()
#
FUNCTION(SHOW_ALL_VARIABLES)
GET_CMAKE_PROPERTY(varnames VARIABLES)
FOREACH(varname ${varnames})
MESSAGE(STATUS "${varname}=${${varname}}")
ENDFOREACH()
ENDFUNCTION()
## ------- FUNCTION SHOW_VARIABLE --------
# Use MESSAGE to print the value of a variable.
#
# Usage:
# SHOW_VARIABLE(VAR1 VAR2 VAR3)
#
#
FUNCTION(SHOW_VARIABLE)
SET(ARGLIST "${ARGN}")
FOREACH(ARG IN LISTS ARGLIST)
MESSAGE(STATUS "${ARG}=${${ARG}}")
ENDFOREACH()
#MESSAGE(STATUS "${VAR}=${${VAR}}")
ENDFUNCTION()
## ------- FUNCTION SHOW_PROJECT_INFO --------
# Show various information about your project.
#
# Usage:
# SHOW_PROJECT_INFO()
#
FUNCTION(SHOW_PROJECT_INFO)
MESSAGE("Project: ${PROJECT_NAME} (${PROJECT_VERSION})")
MESSAGE("CMake: ${CMAKE_VERSION} ")
# C compiler information
IF(CMAKE_C_COMPILER_VERSION)
MESSAGE("C-Compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID}, ${CMAKE_C_COMPILER_VERSION})")
ELSE()
MESSAGE("C-Compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})")
ENDIF()
# CXX compiler information
IF(CMAKE_CXX_COMPILER_VERSION)
MESSAGE("C++-Compiler: ${CMAKE_CXX_COMPILER} (${CMAKE_CXX_COMPILER_ID}, ${CMAKE_CXX_COMPILER_VERSION})")
ELSE()
MESSAGE("C++-Compiler: ${CMAKE_CXX_COMPILER} (${CMAKE_CXX_COMPILER_ID})")
ENDIF()
# fortran compiler information
IF(CMAKE_Fortran_COMPILER_VERSION)
MESSAGE("Fortran-Compiler: ${CMAKE_Fortran_COMPILER} (${CMAKE_Fortran_COMPILER_ID}, ${CMAKE_Fortran_COMPILER_VERSION})")
ELSE()
MESSAGE("Fortran-Compiler: ${CMAKE_Fortran_COMPILER} (${CMAKE_Fortran_COMPILER_ID})")
ENDIF()
MESSAGE("Source Dir: ${PROJECT_SOURCE_DIR}")
MESSAGE("Binary Dir: ${PROJECT_BINARY_DIR}")
MESSAGE("System: ${CMAKE_HOST_SYSTEM} ${CMAKE_HOST_SYSTEM_PROCESSOR}")
ENDFUNCTION()
## ------- FUNCTION SET_IFNDEF --------
# SET a variable to a value if it is not defined.
#
# Usage:
# SET_IFNDEF(VAR 1)
#
FUNCTION(SET_IFNDEF VAR VAL)
IF(NOT DEFINED ${VAR})
SET(${VAR} ${VAL} PARENT_SCOPE)
ENDIF()
ENDFUNCTION()
## ------- FUNCTION CHECK_ADD_FLAG -----
#
# Check if a flag works and add them.
#
# Usage:
# CHECK_ADD_C_FLAG("-Wall" SUCCESS)
# CHECK_ADD_CXX_FLAG("-Wall" SUCCESS)
# CHECK_ADD_FORTRAN_FLAG("-Wall" SUCCESS)
#
MACRO(CHECK_ADD_C_FLAG _FLAG OUTPUT)
CHECK_C_COMPILER_FLAG(${_FLAG} _TEST_${_FLAG})
SET(${OUTPUT} FALSE)
IF(_TEST_${_FLAG})
MESSAGE(STATUS "ADD C_FLAGS: ${_FLAG}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FLAG}")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${_FLAG}")
SET(${OUTPUT} TRUE)
ENDIF()
ENDMACRO()
MACRO(CHECK_ADD_CXX_FLAG _FLAG OUTPUT)
CHECK_CXX_COMPILER_FLAG(${_FLAG} _TEST_${_FLAG})
SET(${OUTPUT} FALSE)
IF(_TEST_${_FLAG})
MESSAGE(STATUS "ADD CXX_FLAGS: ${_FLAG}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_FLAG}")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${_FLAG}")
SET(${OUTPUT} TRUE)
ENDIF()
ENDMACRO()
MACRO(CHECK_ADD_FORTRAN_FLAG _FLAG OUTPUT)
CHECK_FORTRAN_COMPILER_FLAG(${_FLAG} _TEST_${_FLAG})
SET(${OUTPUT} FALSE)
IF(_TEST_${_FLAG})
MESSAGE(STATUS "ADD FORTRAN_FLAGS: ${_FLAG}")
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${_FLAG}")
SET(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${_FLAG}")
SET(${OUTPUT} TRUE)
ENDIF()
ENDMACRO()
## ------- COLOR FOR OUTPUT -----
#
# Extendend Message Function with COLOR Support.
#
# Usage:
# MESSAGE_COLOR("64 Bit integer support is activated but experimental.")
# MESSAGE_COLOR(COLOR_BOLD_CYAN "64 Bit integer support is activated but experimental.")
# MESSAGE_COLOR(STATUS "64 Bit integer support is activated but experimental.")
# MESSAGE_COLOR(STATUS COLOR_BOLD_CYAN "64 Bit integer support is activated but experimental.")
#
#
IF(NOT WIN32)
STRING(ASCII 27 COLOR_ESC)
SET(COLOR_RESET "${COLOR_ESC}[m")
SET(COLOR_BOLD "${COLOR_ESC}[1m")
SET(COLOR_RED "${COLOR_ESC}[31m")
SET(COLOR_GREEN "${COLOR_ESC}[32m")
SET(COLOR_YELLOW "${COLOR_ESC}[33m")
SET(COLOR_BLUE "${COLOR_ESC}[34m")
SET(COLOR_MAGENTA "${COLOR_ESC}[35m")
SET(COLOR_CYAN "${COLOR_ESC}[36m")
SET(COLOR_WHITE "${COLOR_ESC}[37m")
SET(COLOR_BOLD_RED "${COLOR_ESC}[1;31m")
SET(COLOR_BOLD_GREEN "${COLOR_ESC}[1;32m")
SET(COLOR_BOLD_YELLOW "${COLOR_ESC}[1;33m")
SET(COLOR_BOLD_BLUE "${COLOR_ESC}[1;34m")
SET(COLOR_BOLD_MAGENTA "${COLOR_ESC}[1;35m")
SET(COLOR_BOLD_CYAN "${COLOR_ESC}[1;36m")
SET(COLOR_BOLD_WHITE "${COLOR_ESC}[1;37m")
ENDIF()
FUNCTION(MESSAGE_COLOR)
IF(${ARGC} EQUAL 1)
# COLOR NO, STATUS NO
MESSAGE("${ARGV0}")
ELSEIF(${ARGC} EQUAL 2)
# check first argumnent if it is an option from MESSAGE
IF(";STATUS;WARNING;AUTHOR_WARNING;SEND_ERROR;FATAL_ERROR;DEPRECATION" MATCHES ";${ARGV0};")
# COLOR NO, STATUS YES
MESSAGE(${ARGV0} "${ARGV1}")
ELSE()
# COLOR YES, STATUS NO
MESSAGE("${${ARGV0}}${ARGV1}${COLOR_RESET}")
ENDIF()
ELSEIF(${ARGC} EQUAL 3)
# COLOR YES, STATUS YES
MESSAGE(${ARGV0} "${${ARGV1}}${ARGV2}${COLOR_RESET}")
ELSE()
MESSAGE(AUTHOR_WARNING "UNKOWN CALLING SEQUENCE OF MESSAGE_COLOR. PRINT STANDARD MESSAGE")
MESSAGE("${ARGV}")
ENDIF()
ENDFUNCTION()
## ------- MACRO GET_INC_LIB_DIR -----
#
# Get include/library directories from environment variable.
#
# Usage:
# GET_INC_LIB_DIR(INCDIR LIBDIR)
#
MACRO(GET_INC_LIB_DIR INCDIR LIBDIR)
STRING(REPLACE ":" ";" _libdir "$ENV{LIB}" "$ENV{DYLD_LIBRARY_PATH}" "$ENV{LD_LIBRARY_PATH}")
SET(_incdir "${_incdir}" $ENV{INC} $ENV{INCLUDE} $ENV{CPATH})
SET(${INCDIR} ${_incdir})
SET(${LIBDIR} ${_libdir})
ENDMACRO()
## ------- FUNCTION FIND_PYTHON_MODULE -----
#
# Find a Python Module.
#
# Found at:
# http://www.cmake.org/pipermail/cmake/2011-January/041666.html
# https://github.com/ivansafrin/Polycode/blob/master/CMake/FindPythonModule.cmake
#
# USAGE:
# FIND_PYTHON_MODULE(${PYTHON_EXECUTABLE} numpydoc)
#
FUNCTION(FIND_PYTHON_MODULE PYTHON_EXECUTABLE MODULE)
STRING(TOUPPER ${MODULE} MODULE_UPPER)
IF(NOT PY_${MODULE_UPPER})
IF(ARGC GREATER 2 AND ARGV2 STREQUAL "REQUIRED")
SET(${MODULE}_FIND_REQUIRED TRUE)
ENDIF()
# A module's location is usually a directory, but for binary modules
# it's a .so file.
EXECUTE_PROCESS(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import re, ${MODULE}; print(re.compile('/__init__.py.*').sub('',${MODULE}.__file__))"
RESULT_VARIABLE _${MODULE}_STATUS
OUTPUT_VARIABLE _${MODULE}_LOCATION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT _${MODULE}_STATUS)
SET(PY_${MODULE_UPPER} ${_${MODULE}_LOCATION} CACHE STRING "Location of Python module ${MODULE}")
ENDIF()
ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PY_${MODULE} DEFAULT_MSG PY_${MODULE_UPPER})
MARK_AS_ADVANCED(PY_${MODULE_UPPER})
ENDFUNCTION()
# Install the CMake Modules
#SET(DEST "${CMAKE_ROOT}/share/cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/Modules/")
IF(INSTMODULES STREQUAL ON)
SET(DEST ${CMAKE_ROOT}/Modules/)
MESSAGE(STATUS "Install CMAKE Modules to: ${DEST}")
INSTALL(FILES FindAMD.cmake FindCOLAMD.cmake FindGfortran.cmake FindSLICOT.cmake
FindUMFPACK.cmake FindCHOLMOD.cmake FindCSPARSE.cmake
FindRRQR.cmake FindUFCONFIG.cmake FindMESS.cmake
DESTINATION ${DEST})
ENDIF()
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# GNU
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wunused -g ")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
IF(INTEGER8 STREQUAL ON)
ADD_DEFINITIONS(-DINTEGER8)
ENDIF()
IF(HOSTOPT STREQUAL ON)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native")
ENDIF()
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# Intel
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -w2 -g")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
IF(INTEGER8 STREQUAL ON)
ADD_DEFINITIONS(-DINTEGER8)
ENDIF()
IF(HOSTOPT STREQUAL ON)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost")
ENDIF()
ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
# PGI
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O4 ")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Minfo=all")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fpic")
IF(INTEGER8 STREQUAL ON)
ADD_DEFINITIONS(-DINTEGER8)
ENDIF()
ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "XL")
# IBM XL
IF(HOSTOPT STREQUAL ON)
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O5 -qtune=auto -qarch=auto")
ELSE()
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qpic")
STRING(REPLACE "-qhalt=e" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
IF(INTEGER8 STREQUAL ON)
ADD_DEFINITIONS(-DINTEGER8)
ENDIF()
IF(OPENMP_FOUND)
LIST(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "xlomp_ser")
ENDIF()
ENDIF()
# - Check if a C compiler attribute exists
# CHECK_ATTRIBUTE_EXISTS(<attribute> <variable>)
#
# Check that the <attribute> is supported by the compiler and
# store the result in a <variable>.
#
#=============================================================================
# Copyright 2012 Martin Köhler, MPI-Magdeburg
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
MACRO(CHECK_ATTRIBUTE_EXISTS ATTRIBUTE VARIABLE)
SET(_FAIL_REGEX "attribute directive ignored")
MESSAGE(STATUS "Check for __attribute__((${ATTRIBUTE}))")
FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
"void bar (int bar) __attribute__((${ATTRIBUTE}));
void foo (int bar) { return; }
int main(){}")
TRY_COMPILE(COMPILES
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
OUTPUT_VARIABLE OUTPUT)
FOREACH(_regex ${_FAIL_REGEX})
IF("${OUTPUT}" MATCHES "${_regex}")
SET(COMPILES FALSE)
ENDIF()
ENDFOREACH()
IF(COMPILES)
MESSAGE(STATUS "Looking for attribute: ${ATTRIBUTE} - works")
SET(${VARIABLE} 1 CACHE INTERNAL "Have attribute ${ATTRIBUTE}")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the attribute ${ATTRIBUTE} exists passed with the following output:\n"
"${OUTPUT}\n\n")
ELSE()
MESSAGE(STATUS "Looking for attribute ${ATTRIBUTE} - not found")
SET(${VARIABLE} "" CACHE INTERNAL "Have attribute ${ATTRIBUTE}")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the attribute ${ATTRIBUTE} exists failed with the following output:\n"
"${OUTPUT}\n\n")
ENDIF()
ENDMACRO()
# Checks if a given BLAS library contains the IntelMKL calling sequence
# for ZDOTC. If this holds true ZDOTC_MKL is set to true
#
#
#
INCLUDE(CheckCSourceRuns)
MACRO(CheckBlasZdotcMKL BLAS_LIBS BLAS_LD_FLAGS INT8)
SET(__CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
SET(__CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
SET(__CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
SET(__CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
UNSET(ZDOTC_MKL CACHE)
IF(INT8)
SET(CMAKE_REQUIRED_DEFINITIONS "-DInt=int64_t")
ELSE()
SET(CMAKE_REQUIRED_DEFINITIONS "-DInt=int")
ENDIF()
SET(CMAKE_REQUIRED_LIBRARIES ${BLAS_LIBS})
SET(CMAKE_REQUIRED_FLAGS ${BLAS_LD_FLAGS})
CHECK_C_SOURCE_RUNS(
"
#include <stdio.h>
#include <stdlib.h>
#include <complex.h>
#include <stdint.h>
double complex zdotc_(Int *n, double complex *X, Int *incx, double complex *Y, Int *INCY , Int *dummy);
int main ( ) {
Int n = 4;
Int incx = 1, incy = 1;
Int dummy= 1;
double complex x[4] = {1,1,3,4};
double complex y[4] = {2,2,1,1};
double complex ret;
ret = zdotc_(&n,x,&incx,y,&incy,&dummy);
printf(\"n = %d ret = %lg\", n, creal(ret));
if (n!=4) return 0;
return -1;
abort();
}"
ZDOTC_MKL)
SET(CMAKE_REQUIRED_FLAGS ${__CMAKE_REQUIRED_FLAGS})
SET(CMAKE_REQUIRED_DEFINITIONS ${__CMAKE_REQUIRED_DEFINITIONS})
SET(CMAKE_REQUIRED_INCLUDES ${__CMAKE_REQUIRED_INCLUDES})
SET(CMAKE_REQUIRED_LIBRARIES ${__CMAKE_REQUIRED_LIBRARIES})
ENDMACRO()
INCLUDE(CheckSymbolExists)
MACRO(CHECK_FEATURE_NEEDED SYMBOL FILES VARIABLE_FOUND VARIABLE_DEFINE)
SET(_FEATURES
"_NONE_"
"_POSIX_C_SOURCE=1"
"_POSIX_C_SOURCE=200112L"
"_POSIX_C_SOURCE=200809L"
"_XOPEN_SOURCE=500"
"_GNU_SOURCE"
"_BSD_SOURCE"
${ARGN})
SET(${VARIABLE_FOUND} FALSE)
SET(${VARIABLE_DEFINE} "")
SET(_DEFS ${CMAKE_REQUIRED_DEFINITIONS})
SET(_QUIET ${CMAKE_REQUIRED_QUIET})
SET(CMAKE_REQUIRED_QUIET TRUE)
MESSAGE(STATUS "Looking for ${SYMBOL}")
FOREACH(_FEATURE ${_FEATURES})
SET(CMAKE_REQUIRED_DEFINITIONS "-D${_FEATURE}")
UNSET(_NEED_FEATURE_FOUND CACHE)
CHECK_SYMBOL_EXISTS(${SYMBOL} ${FILES} _NEED_FEATURE_FOUND)
IF(_NEED_FEATURE_FOUND)
MESSAGE(STATUS "Looking for ${SYMBOL} - found (using ${_FEATURE}).")
SET(${VARIABLE_FOUND} TRUE)
SET(${VARIABLE_DEFINE} "-D${_FEATURE}")
BREAK()
ENDIF()
ENDFOREACH()
IF(NOT ${VARIABLE_FOUND})
MESSAGE(STATUS "Looking for ${SYMBOL} - not found.")
ENDIF()
SET(CMAKE_REQUIRED_DEFINITIONS ${_DEFS})
SET(CMAKE_REQUIRED_QUIET ${_QUIET})
ENDMACRO()
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# CheckFortranCompilerFlag
# ------------------------
#
# Check whether the Fortran compiler supports a given flag.
#
# CHECK_Fortran_COMPILER_FLAG(<flag> <var>)
#
# ::
#
# <flag> - the compiler flag
# <var> - variable to store the result
# Will be created as an internal cache variable.
#
# This internally calls the check_fortran_source_compiles macro and
# sets CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for