diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeFortranCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/FindCUDA.cmake | 54 | ||||
-rw-r--r-- | Modules/FindMatlab.cmake | 43 | ||||
-rw-r--r-- | Modules/FindOpenSSL.cmake | 17 |
4 files changed, 86 insertions, 30 deletions
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 8e92f65..69800d7 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -55,6 +55,8 @@ if(CMAKE_Fortran_LIBRARY_ARCHITECTURE) endif() @CMAKE_Fortran_COMPILER_CUSTOM_CODE@ +@CMAKE_Fortran_SYSROOT_FLAG_CODE@ +@CMAKE_Fortran_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ set(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@") set(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@") diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 317a9cd..aaa1536 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1188,6 +1188,18 @@ endfunction() macro(CUDA_WRAP_SRCS cuda_target format generated_files) + # Put optional arguments in list. + set(_argn_list "${ARGN}") + # If one of the given optional arguments is "PHONY", make a note of it, then + # remove it from the list. + list(FIND _argn_list "PHONY" _phony_idx) + if("${_phony_idx}" GREATER "-1") + set(_target_is_phony true) + list(REMOVE_AT _argn_list ${_phony_idx}) + else() + set(_target_is_phony false) + endif() + # If CMake doesn't support separable compilation, complain if(CUDA_SEPARABLE_COMPILATION AND CMAKE_VERSION VERSION_LESS "2.8.10.1") message(SEND_ERROR "CUDA_SEPARABLE_COMPILATION isn't supported for CMake versions less than 2.8.10.1") @@ -1250,13 +1262,24 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) # Initialize our list of includes with the user ones followed by the CUDA system ones. set(CUDA_NVCC_INCLUDE_DIRS ${CUDA_NVCC_INCLUDE_DIRS_USER} "${CUDA_INCLUDE_DIRS}") - # Append the include directories for this target via generator expression, which is - # expanded by the FILE(GENERATE) call below. This generator expression captures all - # include dirs set by the user, whether via directory properties or target properties - list(APPEND CUDA_NVCC_INCLUDE_DIRS "$<TARGET_PROPERTY:${cuda_target},INCLUDE_DIRECTORIES>") + if(_target_is_phony) + # If the passed in target name isn't a real target (i.e., this is from a call to one of the + # cuda_compile_* functions), need to query directory properties to get include directories + # and compile definitions. + get_directory_property(_dir_include_dirs INCLUDE_DIRECTORIES) + get_directory_property(_dir_compile_defs COMPILE_DEFINITIONS) + + list(APPEND CUDA_NVCC_INCLUDE_DIRS "${_dir_include_dirs}") + set(CUDA_NVCC_COMPILE_DEFINITIONS "${_dir_compile_defs}") + else() + # Append the include directories for this target via generator expression, which is + # expanded by the FILE(GENERATE) call below. This generator expression captures all + # include dirs set by the user, whether via directory properties or target properties + list(APPEND CUDA_NVCC_INCLUDE_DIRS "$<TARGET_PROPERTY:${cuda_target},INCLUDE_DIRECTORIES>") - # Do the same thing with compile definitions - set(CUDA_NVCC_COMPILE_DEFINITIONS "$<TARGET_PROPERTY:${cuda_target},COMPILE_DEFINITIONS>") + # Do the same thing with compile definitions + set(CUDA_NVCC_COMPILE_DEFINITIONS "$<TARGET_PROPERTY:${cuda_target},COMPILE_DEFINITIONS>") + endif() # Reset these variables @@ -1266,7 +1289,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) set(CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}) endforeach() - CUDA_GET_SOURCES_AND_OPTIONS(_cuda_wrap_sources _cuda_wrap_cmake_options _cuda_wrap_options ${ARGN}) + CUDA_GET_SOURCES_AND_OPTIONS(_cuda_wrap_sources _cuda_wrap_cmake_options _cuda_wrap_options ${_argn_list}) CUDA_PARSE_NVCC_OPTIONS(CUDA_WRAP_OPTION_NVCC_FLAGS ${_cuda_wrap_options}) # Figure out if we are building a shared library. BUILD_SHARED_LIBS is @@ -1356,7 +1379,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) # Iterate over the macro arguments and create custom # commands for all the .cu files. - foreach(file ${ARGN}) + foreach(file ${_argn_list}) # Ignore any file marked as a HEADER_FILE_ONLY get_source_file_property(_is_header ${file} HEADER_FILE_ONLY) # Allow per source file overrides of the format. Also allows compiling non-.cu files. @@ -1774,12 +1797,23 @@ endmacro() ############################################################################### ############################################################################### macro(cuda_compile_base cuda_target format generated_files) + # Update a counter in this directory, to keep phony target names unique. + set(_cuda_target "${cuda_target}") + get_property(_counter DIRECTORY PROPERTY _cuda_internal_phony_counter) + if(_counter) + math(EXPR _counter "${_counter} + 1") + else() + set(_counter 1) + endif() + set(_cuda_target "${_cuda_target}_${_counter}") + set_property(DIRECTORY PROPERTY _cuda_internal_phony_counter ${_counter}) # Separate the sources from the options CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN}) + # Create custom commands and targets for each file. - CUDA_WRAP_SRCS( ${cuda_target} ${format} _generated_files ${_sources} ${_cmake_options} - OPTIONS ${_options} ) + CUDA_WRAP_SRCS( ${_cuda_target} ${format} _generated_files ${_sources} + ${_cmake_options} OPTIONS ${_options} PHONY) set( ${generated_files} ${_generated_files}) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 46285aa..9f96fe6 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -15,8 +15,8 @@ # # The module supports the following components: # -# * ``MX_LIBRARY`` and ``ENG_LIBRARY`` respectively the MX and ENG libraries of -# Matlab +# * ``MX_LIBRARY``, ``ENG_LIBRARY`` and ``MAT_LIBRARY``: respectively the MX, +# ENG and MAT libraries of Matlab # * ``MAIN_PROGRAM`` the Matlab binary program. # # .. note:: @@ -93,6 +93,9 @@ # ``Matlab_ENG_LIBRARY`` # Matlab engine library. Available only if the component ``ENG_LIBRARY`` # is requested. +# ``Matlab_MAT_LIBRARY`` +# Matlab matrix library. Available only if the component ``MAT_LIBRARY`` +# is requested. # ``Matlab_LIBRARIES`` # the whole set of libraries of Matlab # ``Matlab_MEX_COMPILER`` @@ -1213,6 +1216,7 @@ if(DEFINED Matlab_ROOT_DIR_LAST_CACHED) Matlab_MAIN_PROGRAM Matlab_MX_LIBRARY Matlab_ENG_LIBRARY + Matlab_MAT_LIBRARY Matlab_MEX_EXTENSION # internal @@ -1346,7 +1350,6 @@ _Matlab_find_library( NO_DEFAULT_PATH ) - list(APPEND _matlab_required_variables Matlab_MEX_LIBRARY) # the MEX extension is required @@ -1355,7 +1358,6 @@ list(APPEND _matlab_required_variables Matlab_MEX_EXTENSION) # the matlab root is required list(APPEND _matlab_required_variables Matlab_ROOT_DIR) - # component Mex Compiler list(FIND Matlab_FIND_COMPONENTS MEX_COMPILER _matlab_find_mex_compiler) if(_matlab_find_mex_compiler GREATER -1) @@ -1366,7 +1368,6 @@ if(_matlab_find_mex_compiler GREATER -1) DOC "Matlab MEX compiler" NO_DEFAULT_PATH ) - if(Matlab_MEX_COMPILER) set(Matlab_MEX_COMPILER_FOUND TRUE) endif() @@ -1376,7 +1377,6 @@ unset(_matlab_find_mex_compiler) # component Matlab program list(FIND Matlab_FIND_COMPONENTS MAIN_PROGRAM _matlab_find_matlab_program) if(_matlab_find_matlab_program GREATER -1) - find_program( Matlab_MAIN_PROGRAM matlab @@ -1384,11 +1384,9 @@ if(_matlab_find_matlab_program GREATER -1) DOC "Matlab main program" NO_DEFAULT_PATH ) - if(Matlab_MAIN_PROGRAM) set(Matlab_MAIN_PROGRAM_FOUND TRUE) endif() - endif() unset(_matlab_find_matlab_program) @@ -1402,14 +1400,12 @@ if(_matlab_find_mx GREATER -1) PATHS ${_matlab_lib_dir_for_search} NO_DEFAULT_PATH ) - if(Matlab_MX_LIBRARY) set(Matlab_MX_LIBRARY_FOUND TRUE) endif() endif() unset(_matlab_find_mx) - # Component ENG library list(FIND Matlab_FIND_COMPONENTS ENG_LIBRARY _matlab_find_eng) if(_matlab_find_eng GREATER -1) @@ -1426,15 +1422,26 @@ if(_matlab_find_eng GREATER -1) endif() unset(_matlab_find_eng) - - +# Component MAT library +list(FIND Matlab_FIND_COMPONENTS MAT_LIBRARY _matlab_find_mat) +if(_matlab_find_mat GREATER -1) + _Matlab_find_library( + ${_matlab_lib_prefix_for_search} + Matlab_MAT_LIBRARY + mat + PATHS ${_matlab_lib_dir_for_search} + NO_DEFAULT_PATH + ) + if(Matlab_MAT_LIBRARY) + set(Matlab_MAT_LIBRARY_FOUND TRUE) + endif() +endif() +unset(_matlab_find_mat) unset(_matlab_lib_dir_for_search) - -set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY}) - +set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY} ${Matlab_MAT_LIBRARY}) find_package_handle_standard_args( Matlab @@ -1453,18 +1460,14 @@ unset(_matlab_lib_prefix_for_search) if(Matlab_INCLUDE_DIRS AND Matlab_LIBRARIES) mark_as_advanced( - #Matlab_LIBRARIES Matlab_MEX_LIBRARY Matlab_MX_LIBRARY Matlab_ENG_LIBRARY + Matlab_MAT_LIBRARY Matlab_INCLUDE_DIRS Matlab_FOUND - #Matlab_ROOT_DIR - #Matlab_VERSION_STRING Matlab_MAIN_PROGRAM - #Matlab_MEX_EXTENSION Matlab_MEXEXTENSIONS_PROG Matlab_MEX_EXTENSION - #Matlab_BINARIES_DIR ) endif() diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 10b62ff..7ddd783 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -133,6 +133,13 @@ if(WIN32 AND NOT CYGWIN) set(_OPENSSL_MSVC_RT_MODE "MD") endif () + # Since OpenSSL 1.1, lib names are like libcrypto32MTd.lib and libssl32MTd.lib + if( "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" ) + set(_OPENSSL_MSVC_ARCH_SUFFIX "64") + else() + set(_OPENSSL_MSVC_ARCH_SUFFIX "32") + endif() + if(OPENSSL_USE_STATIC_LIBS) set(_OPENSSL_PATH_SUFFIXES "lib" @@ -149,6 +156,8 @@ if(WIN32 AND NOT CYGWIN) find_library(LIB_EAY_DEBUG NAMES + libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d + libcryptod libeay32${_OPENSSL_MSVC_RT_MODE}d libeay32d NAMES_PER_DIR @@ -159,6 +168,8 @@ if(WIN32 AND NOT CYGWIN) find_library(LIB_EAY_RELEASE NAMES + libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE} + libcrypto libeay32${_OPENSSL_MSVC_RT_MODE} libeay32 NAMES_PER_DIR @@ -169,6 +180,8 @@ if(WIN32 AND NOT CYGWIN) find_library(SSL_EAY_DEBUG NAMES + libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d + libssld ssleay32${_OPENSSL_MSVC_RT_MODE}d ssleay32d NAMES_PER_DIR @@ -179,6 +192,8 @@ if(WIN32 AND NOT CYGWIN) find_library(SSL_EAY_RELEASE NAMES + libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE} + libssl ssleay32${_OPENSSL_MSVC_RT_MODE} ssleay32 ssl @@ -236,6 +251,7 @@ if(WIN32 AND NOT CYGWIN) # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues: find_library(LIB_EAY NAMES + libcrypto libeay32 NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} @@ -247,6 +263,7 @@ if(WIN32 AND NOT CYGWIN) find_library(SSL_EAY NAMES + libssl ssleay32 NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} |