summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindBLAS.cmake8
-rw-r--r--Modules/FindRuby.cmake20
-rw-r--r--Modules/FortranCInterface.cmake8
-rw-r--r--Modules/FortranCInterface/Detect.cmake10
-rw-r--r--Modules/Platform/Android-Determine.cmake17
5 files changed, 51 insertions, 12 deletions
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index e4353df..715049b 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -586,16 +586,22 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
else()
find_package(Threads REQUIRED)
endif()
+ set(_threadlibs "${CMAKE_THREAD_LIBS_INIT}")
+ if(BLA_STATIC)
+ find_package(OpenMP COMPONENTS C)
+ list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}")
+ endif()
check_blas_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"openblas"
- "${CMAKE_THREAD_LIBS_INIT}"
+ "${_threadlibs}"
""
""
)
+ unset(_threadlibs)
endif()
endif()
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index a0cdf3b..d12f825 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -401,6 +401,7 @@ if(Ruby_VERSION_MAJOR)
set(_Ruby_VERSION_SHORT "${Ruby_VERSION_MAJOR}.${Ruby_VERSION_MINOR}")
set(_Ruby_VERSION_SHORT_NODOT "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}")
set(_Ruby_NODOT_VERSION "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}${Ruby_VERSION_PATCH}")
+ set(_Ruby_NODOT_VERSION_ZERO_PATCH "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}0")
endif()
# FIXME: Currently we require both the interpreter and development components to be found
@@ -433,22 +434,27 @@ endif()
set(_Ruby_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_Ruby_VERSION_SHORT} ruby${_Ruby_VERSION_SHORT_NODOT} ruby-${_Ruby_VERSION_SHORT} ruby-${Ruby_VERSION})
if(WIN32)
+ set(_Ruby_POSSIBLE_MSVC_RUNTIMES "msvcrt;vcruntime140;vcruntime140_1")
if(MSVC_TOOLSET_VERSION)
- set(_Ruby_MSVC_RUNTIME "${MSVC_TOOLSET_VERSION}")
+ list(APPEND _Ruby_POSSIBLE_MSVC_RUNTIMES "msvcr${MSVC_TOOLSET_VERSION}")
else()
- set(_Ruby_MSVC_RUNTIME "")
+ list(APPEND _Ruby_POSSIBLE_MSVC_RUNTIMES "msvcr")
endif()
+ set(_Ruby_POSSIBLE_VERSION_SUFFICES "${_Ruby_NODOT_VERSION};${_Ruby_NODOT_VERSION_ZERO_PATCH}")
+
set(_Ruby_ARCH_PREFIX "")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_Ruby_ARCH_PREFIX "x64-")
endif()
- list(APPEND _Ruby_POSSIBLE_LIB_NAMES
- "${_Ruby_ARCH_PREFIX}msvcr${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_NODOT_VERSION}"
- "${_Ruby_ARCH_PREFIX}msvcr${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_NODOT_VERSION}-static"
- "${_Ruby_ARCH_PREFIX}msvcrt-ruby${_Ruby_NODOT_VERSION}"
- "${_Ruby_ARCH_PREFIX}msvcrt-ruby${_Ruby_NODOT_VERSION}-static" )
+ foreach(_Ruby_MSVC_RUNTIME ${_Ruby_POSSIBLE_MSVC_RUNTIMES})
+ foreach(_Ruby_VERSION_SUFFIX ${_Ruby_POSSIBLE_VERSION_SUFFICES})
+ list(APPEND _Ruby_POSSIBLE_LIB_NAMES
+ "${_Ruby_ARCH_PREFIX}${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_VERSION_SUFFIX}"
+ "${_Ruby_ARCH_PREFIX}${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_VERSION_SUFFIX}-static")
+ endforeach()
+ endforeach()
endif()
find_library(Ruby_LIBRARY NAMES ${_Ruby_POSSIBLE_LIB_NAMES} HINTS ${Ruby_POSSIBLE_LIB_DIR} )
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index 547346b..733c723 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -343,6 +343,13 @@ function(FortranCInterface_VERIFY)
set(_desc "Verifying Fortran/${lang} Compiler Compatibility")
message(CHECK_START "${_desc}")
+ cmake_policy(GET CMP0056 _FortranCInterface_CMP0056)
+ if(_FortranCInterface_CMP0056 STREQUAL "NEW")
+ set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}")
+ else()
+ set(_FortranCInterface_EXE_LINKER_FLAGS "")
+ endif()
+
# Build a sample project which reports symbols.
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
try_compile(FortranCInterface_VERIFY_${lang}_COMPILED
@@ -358,6 +365,7 @@ function(FortranCInterface_VERIFY)
"-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}"
"-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}"
"-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
+ ${_FortranCInterface_EXE_LINKER_FLAGS}
OUTPUT_VARIABLE _output)
file(WRITE "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" "${_output}")
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index c75067b..998faf1 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -26,6 +26,14 @@ unset(FortranCInterface_VERIFIED_CXX CACHE)
set(_result)
+cmake_policy(GET CMP0056 _FortranCInterface_CMP0056)
+if(_FortranCInterface_CMP0056 STREQUAL "NEW")
+ set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}")
+else()
+ set(_FortranCInterface_EXE_LINKER_FLAGS "")
+endif()
+unset(_FortranCInterface_CMP0056)
+
# Build a sample project which reports symbols.
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
try_compile(FortranCInterface_COMPILED
@@ -38,9 +46,11 @@ try_compile(FortranCInterface_COMPILED
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
"-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}"
"-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
+ ${_FortranCInterface_EXE_LINKER_FLAGS}
OUTPUT_VARIABLE FortranCInterface_OUTPUT)
set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED})
unset(FortranCInterface_COMPILED CACHE)
+unset(_FortranCInterface_EXE_LINKER_FLAGS)
# Locate the sample project executable.
set(FortranCInterface_EXE)
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake
index 2c906ae..77e621a 100644
--- a/Modules/Platform/Android-Determine.cmake
+++ b/Modules/Platform/Android-Determine.cmake
@@ -208,8 +208,13 @@ if(NOT CMAKE_ANDROID_NDK AND NOT CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
endif()
if(CMAKE_ANDROID_NDK)
- # NDK >= 18 has abis.cmake and platforms.cmake.
+ # NDK >= 18 has platforms.cmake. It provides:
+ # NDK_MIN_PLATFORM_LEVEL
+ # NDK_MAX_PLATFORM_LEVEL
include("${CMAKE_ANDROID_NDK}/build/cmake/platforms.cmake" OPTIONAL RESULT_VARIABLE _INCLUDED_PLATFORMS)
+ # NDK >= 18 has abis.cmake. It provides:
+ # NDK_KNOWN_DEVICE_ABI32S
+ # NDK_KNOWN_DEVICE_ABI64S
include("${CMAKE_ANDROID_NDK}/build/cmake/abis.cmake" OPTIONAL RESULT_VARIABLE _INCLUDED_ABIS)
endif()
@@ -247,6 +252,10 @@ else()
set(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED "")
endif()
+if(_INCLUDED_ABIS)
+ set(_ANDROID_KNOWN_ABIS ${NDK_KNOWN_DEVICE_ABI32S} ${NDK_KNOWN_DEVICE_ABI64S})
+endif()
+
# https://developer.android.com/ndk/guides/abis.html
set(_ANDROID_ABI_arm64-v8a_PROC "aarch64")
@@ -321,7 +330,7 @@ if(NOT CMAKE_ANDROID_ARCH_ABI)
elseif(_INCLUDED_ABIS)
# Default to the oldest ARM ABI.
foreach(abi armeabi armeabi-v7a arm64-v8a)
- if("${abi}" IN_LIST NDK_DEFAULT_ABIS)
+ if("${abi}" IN_LIST _ANDROID_KNOWN_ABIS)
set(CMAKE_ANDROID_ARCH_ABI "${abi}")
break()
endif()
@@ -367,10 +376,10 @@ if(NOT CMAKE_ANDROID_ARCH_ABI)
endif()
endif()
endif()
-if(_INCLUDED_ABIS AND NOT CMAKE_ANDROID_ARCH_ABI IN_LIST NDK_DEFAULT_ABIS)
+if(_INCLUDED_ABIS AND NOT CMAKE_ANDROID_ARCH_ABI IN_LIST _ANDROID_KNOWN_ABIS)
message(FATAL_ERROR
"Android: ABI '${CMAKE_ANDROID_ARCH_ABI}' is not supported by the NDK.\n"
- "Supported ABIS: ${NDK_DEFAULT_ABIS}."
+ "Supported ABIS: ${_ANDROID_KNOWN_ABIS}."
)
endif()
set(CMAKE_ANDROID_ARCH "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_ARCH}")