diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 1 | ||||
-rw-r--r-- | Modules/CMakeDetermineCUDACompiler.cmake | 30 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 1 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 35 | ||||
-rw-r--r-- | Modules/CPackDeb.cmake | 39 | ||||
-rw-r--r-- | Modules/CPackWIX.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/Clang.cmake | 6 | ||||
-rw-r--r-- | Modules/Compiler/GNU.cmake | 6 | ||||
-rw-r--r-- | Modules/ExternalProject.cmake | 5 | ||||
-rw-r--r-- | Modules/FindCUDA.cmake | 40 | ||||
-rw-r--r-- | Modules/FindCUDA/run_nvcc.cmake | 9 | ||||
-rw-r--r-- | Modules/FindJava.cmake | 67 | ||||
-rw-r--r-- | Modules/FindMatlab.cmake | 2 | ||||
-rw-r--r-- | Modules/FindOpenCL.cmake | 5 | ||||
-rw-r--r-- | Modules/FindOpenMP.cmake | 8 | ||||
-rw-r--r-- | Modules/FindProtobuf.cmake | 2 | ||||
-rw-r--r-- | Modules/FindPythonLibs.cmake | 7 | ||||
-rw-r--r-- | Modules/FindXMLRPC.cmake | 43 | ||||
-rw-r--r-- | Modules/UseJava.cmake | 6 |
19 files changed, 229 insertions, 85 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index fcbda20..4e56ce1 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -110,6 +110,7 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c) + CMAKE_DIAGNOSE_UNSUPPORTED_CLANG(C CC) # Set old compiler and platform id variables. if(CMAKE_C_COMPILER_ID STREQUAL "GNU") diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 89ac9fa..c9cd7e2 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -87,6 +87,15 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio") elseif(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA) set(_nvcc_log "") string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}") + if(_nvcc_output_orig MATCHES "#\\\$ +PATH= *([^\n]*)\n") + set(_nvcc_path "${CMAKE_MATCH_1}") + string(APPEND _nvcc_log " found 'PATH=' string: [${_nvcc_path}]\n") + string(REPLACE ":" ";" _nvcc_path "${_nvcc_path}") + else() + set(_nvcc_path "") + string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}") + string(APPEND _nvcc_log " no 'PATH=' string found in nvcc output:${_nvcc_output_log}\n") + endif() if(_nvcc_output_orig MATCHES "#\\\$ +LIBRARIES= *([^\n]*)\n") set(_nvcc_libraries "${CMAKE_MATCH_1}") string(APPEND _nvcc_log " found 'LIBRARIES=' string: [${_nvcc_libraries}]\n") @@ -131,7 +140,26 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA) else() #extract the compiler that is being used for linking separate_arguments(_nvcc_link_line_args UNIX_COMMAND "${_nvcc_link_line}") - list(GET _nvcc_link_line_args 0 CMAKE_CUDA_HOST_LINK_LAUNCHER) + list(GET _nvcc_link_line_args 0 _nvcc_host_link_launcher) + if(IS_ABSOLUTE "${_nvcc_host_link_launcher}") + string(APPEND _nvcc_log " extracted link launcher absolute path: [${_nvcc_host_link_launcher}]\n") + set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_host_link_launcher}") + else() + string(APPEND _nvcc_log " extracted link launcher name: [${_nvcc_host_link_launcher}]\n") + find_program(_nvcc_find_host_link_launcher + NAMES ${_nvcc_host_link_launcher} + PATHS ${_nvcc_path} NO_DEFAULT_PATH) + find_program(_nvcc_find_host_link_launcher + NAMES ${_nvcc_host_link_launcher}) + if(_nvcc_find_host_link_launcher) + string(APPEND _nvcc_log " found link launcher absolute path: [${_nvcc_find_host_link_launcher}]\n") + set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_find_host_link_launcher}") + else() + string(APPEND _nvcc_log " could not find link launcher absolute path\n") + set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_host_link_launcher}") + endif() + unset(_nvcc_find_host_link_launcher CACHE) + endif() endif() #prefix the line with cuda-fake-ld so that implicit link info believes it is diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 8c33eb6..4541844 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -105,6 +105,7 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN) include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp) + CMAKE_DIAGNOSE_UNSUPPORTED_CLANG(CXX CXX) # Set old compiler and platform id variables. if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 7efe739..347106e 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -735,3 +735,38 @@ function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags) set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "" PARENT_SCOPE) endif() endfunction() + +function(CMAKE_DIAGNOSE_UNSUPPORTED_CLANG lang envvar) + if(NOT CMAKE_HOST_WIN32 OR CMAKE_GENERATOR MATCHES "Visual Studio" OR + NOT "${CMAKE_${lang}_COMPILER_ID};${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "Clang;MSVC") + return() + endif() + + # Test whether a GNU-like command-line option works. + execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" --version + RESULT_VARIABLE _clang_result + OUTPUT_VARIABLE _clang_stdout + ERROR_VARIABLE _clang_stderr) + if(NOT _clang_result EQUAL 0) + return() + endif() + + # Help the user configure the environment to use the MSVC-like Clang. + string(CONCAT _msg + "The Clang compiler tool\n" + " \"${CMAKE_${lang}_COMPILER}\"\n" + "targets the MSVC ABI but has a GNU-like command-line interface. " + "This is not supported. " + "Use 'clang-cl' instead, e.g. by setting '${envvar}=clang-cl' in the environment." + ) + execute_process(COMMAND rc -help + RESULT_VARIABLE _rc_result + OUTPUT_VARIABLE _rc_stdout + ERROR_VARIABLE _rc_stderr) + if(NOT _rc_result EQUAL 0) + string(APPEND _msg " " + "Furthermore, use the MSVC command-line environment." + ) + endif() + message(FATAL_ERROR "${_msg}") +endfunction() diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 337bec8..1879827 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -110,6 +110,14 @@ # :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` is not set then hyphens are not # allowed. # +# .. note:: +# +# For backward compatibility with CMake 3.9 and lower a failed test of this +# variable's content is not a hard error when both +# :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` and +# :variable:`CPACK_DEBIAN_PACKAGE_EPOCH` variables are not set. An author +# warning is reported instead. +# # .. variable:: CPACK_DEBIAN_PACKAGE_RELEASE # # The Debian package release - Debian revision number. @@ -753,9 +761,22 @@ function(cpack_deb_prepare_package_vars) set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) endif() - if(NOT CPACK_DEBIAN_PACKAGE_VERSION MATCHES "^[0-9][A-Za-z0-9.+-~]*$") - message(FATAL_ERROR - "CPackDeb: Debian package version must confirm to \"^[0-9][A-Za-z0-9.+-~]*$\" regex!") + if(DEFINED CPACK_DEBIAN_PACKAGE_RELEASE OR DEFINED CPACK_DEBIAN_PACKAGE_EPOCH) + # only test the version format if CPACK_DEBIAN_PACKAGE_RELEASE or + # CPACK_DEBIAN_PACKAGE_EPOCH is set + if(NOT CPACK_DEBIAN_PACKAGE_VERSION MATCHES "^[0-9][A-Za-z0-9.+~-]*$") + message(FATAL_ERROR + "CPackDeb: Debian package version must confirm to \"^[0-9][A-Za-z0-9.+~-]*$\" regex!") + endif() + else() + # before CMake 3.10 version format was not tested so only warn to preserve + # backward compatibility + if(NOT CPACK_DEBIAN_PACKAGE_VERSION MATCHES "^([0-9]+:)?[0-9][A-Za-z0-9.+~-]*$") + message(AUTHOR_WARNING + "CPackDeb: Debian package versioning ([<epoch>:]<version>[-<release>])" + " should confirm to \"^([0-9]+:)?[0-9][A-Za-z0-9.+~-]*$\" regex in" + " order to satisfy Debian packaging rules.") + endif() endif() if(CPACK_DEBIAN_PACKAGE_RELEASE) @@ -765,9 +786,15 @@ function(cpack_deb_prepare_package_vars) endif() string(APPEND CPACK_DEBIAN_PACKAGE_VERSION "-${CPACK_DEBIAN_PACKAGE_RELEASE}") - elseif(CPACK_DEBIAN_PACKAGE_VERSION MATCHES ".*-.*") - message(FATAL_ERROR - "CPackDeb: Debian package version must not contain hyphens when CPACK_DEBIAN_PACKAGE_RELEASE is not provided!") + elseif(DEFINED CPACK_DEBIAN_PACKAGE_EPOCH) + # only test the version format if CPACK_DEBIAN_PACKAGE_RELEASE or + # CPACK_DEBIAN_PACKAGE_EPOCH is set - versions CPack/Deb generator before + # CMake 3.10 did not check for version format so we have to preserve + # backward compatibility + if(CPACK_DEBIAN_PACKAGE_VERSION MATCHES ".*-.*") + message(FATAL_ERROR + "CPackDeb: Debian package version must not contain hyphens when CPACK_DEBIAN_PACKAGE_RELEASE is not provided!") + endif() endif() if(CPACK_DEBIAN_PACKAGE_EPOCH) diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index 1dc37d4..c723e72 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -289,7 +289,7 @@ # if(NOT CPACK_WIX_ROOT) - file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT) + string(REPLACE "\\" "/" CPACK_WIX_ROOT "$ENV{WIX}") endif() find_program(CPACK_WIX_CANDLE_EXECUTABLE candle diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 7d476f9..9f5e921 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -69,15 +69,15 @@ else() endif() set(CMAKE_${lang}_ARCHIVE_CREATE_IPO - "${__ar} cr <TARGET> <LINK_FLAGS> <OBJECTS>" + "\"${__ar}\" cr <TARGET> <LINK_FLAGS> <OBJECTS>" ) set(CMAKE_${lang}_ARCHIVE_APPEND_IPO - "${__ar} r <TARGET> <LINK_FLAGS> <OBJECTS>" + "\"${__ar}\" r <TARGET> <LINK_FLAGS> <OBJECTS>" ) set(CMAKE_${lang}_ARCHIVE_FINISH_IPO - "${__ranlib} <TARGET>" + "\"${__ranlib}\" <TARGET>" ) endmacro() endif() diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 675e505..d962688 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -75,15 +75,15 @@ macro(__compiler_gnu lang) # # [1]: https://gcc.gnu.org/onlinedocs/gcc-4.9.4/gcc/Optimize-Options.html set(CMAKE_${lang}_ARCHIVE_CREATE_IPO - "${CMAKE_${lang}_COMPILER_AR} cr <TARGET> <LINK_FLAGS> <OBJECTS>" + "\"${CMAKE_${lang}_COMPILER_AR}\" cr <TARGET> <LINK_FLAGS> <OBJECTS>" ) set(CMAKE_${lang}_ARCHIVE_APPEND_IPO - "${CMAKE_${lang}_COMPILER_AR} r <TARGET> <LINK_FLAGS> <OBJECTS>" + "\"${CMAKE_${lang}_COMPILER_AR}\" r <TARGET> <LINK_FLAGS> <OBJECTS>" ) set(CMAKE_${lang}_ARCHIVE_FINISH_IPO - "${CMAKE_${lang}_COMPILER_RANLIB} <TARGET>" + "\"${CMAKE_${lang}_COMPILER_RANLIB}\" <TARGET>" ) endif() endmacro() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 76f5080..419c9d6 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -854,6 +854,9 @@ The custom step could then be triggered from the main build like so:: #]=======================================================================] +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced + # Pre-compute a regex to match documented keywords for each command. math(EXPR _ep_documentation_line_count "${CMAKE_CURRENT_LIST_LINE} - 4") file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines @@ -3035,3 +3038,5 @@ function(ExternalProject_Add name) # _ep_add_test_command(${name}) endfunction() + +cmake_policy(POP) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index bd7d0c0..1c8ac26 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -339,7 +339,27 @@ # CUDA_nppc_LIBRARY -- NVIDIA Performance Primitives lib (core). # Only available for CUDA version 5.5+. # CUDA_nppi_LIBRARY -- NVIDIA Performance Primitives lib (image processing). -# Only available for CUDA version 5.5+. +# Only available for CUDA version 5.5 - 8.0. +# CUDA_nppial_LIBRARY -- NVIDIA Performance Primitives lib (image processing). +# Only available for CUDA version 9.0. +# CUDA_nppicc_LIBRARY -- NVIDIA Performance Primitives lib (image processing). +# Only available for CUDA version 9.0. +# CUDA_nppicom_LIBRARY -- NVIDIA Performance Primitives lib (image processing). +# Only available for CUDA version 9.0. +# CUDA_nppidei_LIBRARY -- NVIDIA Performance Primitives lib (image processing). +# Only available for CUDA version 9.0. +# CUDA_nppif_LIBRARY -- NVIDIA Performance Primitives lib (image processing). +# Only available for CUDA version 9.0. +# CUDA_nppig_LIBRARY -- NVIDIA Performance Primitives lib (image processing). +# Only available for CUDA version 9.0. +# CUDA_nppim_LIBRARY -- NVIDIA Performance Primitives lib (image processing). +# Only available for CUDA version 9.0. +# CUDA_nppist_LIBRARY -- NVIDIA Performance Primitives lib (image processing). +# Only available for CUDA version 9.0. +# CUDA_nppisu_LIBRARY -- NVIDIA Performance Primitives lib (image processing). +# Only available for CUDA version 9.0. +# CUDA_nppitc_LIBRARY -- NVIDIA Performance Primitives lib (image processing). +# Only available for CUDA version 9.0. # CUDA_npps_LIBRARY -- NVIDIA Performance Primitives lib (signal processing). # Only available for CUDA version 5.5+. # CUDA_nvcuvenc_LIBRARY -- CUDA Video Encoder library. @@ -939,6 +959,24 @@ if(NOT CUDA_VERSION VERSION_LESS "3.2") endif() if(CUDA_VERSION VERSION_GREATER "5.0") find_cuda_helper_libs(cublas_device) +endif() + +if(NOT CUDA_VERSION VERSION_LESS "9.0") + # In CUDA 9.0 NPP was nppi was removed + find_cuda_helper_libs(nppc) + find_cuda_helper_libs(nppial) + find_cuda_helper_libs(nppicc) + find_cuda_helper_libs(nppicom) + find_cuda_helper_libs(nppidei) + find_cuda_helper_libs(nppif) + find_cuda_helper_libs(nppig) + find_cuda_helper_libs(nppim) + find_cuda_helper_libs(nppist) + find_cuda_helper_libs(nppisu) + find_cuda_helper_libs(nppitc) + find_cuda_helper_libs(npps) + set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}") +elseif(CUDA_VERSION VERSION_GREATER "5.0") # In CUDA 5.5 NPP was splitted onto 3 separate libraries. find_cuda_helper_libs(nppc) find_cuda_helper_libs(nppi) diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index ec5a099..f78119d 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -50,6 +50,8 @@ # generated_cubin_file:STRING=<> File to generate. This argument must be passed # in if build_cubin is true. +cmake_policy(PUSH) +cmake_policy(SET CMP0007 NEW) if(NOT generated_file) message(FATAL_ERROR "You must specify generated_file on the command line") endif() @@ -179,13 +181,8 @@ cuda_execute_process( set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}") set(CUDA_VERSION @CUDA_VERSION@) if(CUDA_VERSION VERSION_LESS "3.0") - cmake_policy(PUSH) - # CMake policy 0007 NEW states that empty list elements are not - # ignored. I'm just setting it to avoid the warning that's printed. - cmake_policy(SET CMP0007 NEW) # Note that this will remove all occurances of -G. list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G") - cmake_policy(POP) endif() # nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This @@ -304,3 +301,5 @@ if( build_cubin ) ) endif() + +cmake_policy(POP) diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index eb2242b..b913e17 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -39,7 +39,7 @@ # Java_VERSION_MINOR = The minor version of the package found. # Java_VERSION_PATCH = The patch version of the package found. # Java_VERSION_TWEAK = The tweak version of the package found (after '_') -# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak) +# Java_VERSION = This is set to: $major[.$minor[.$patch[.$tweak]]] # # # @@ -133,39 +133,56 @@ if(Java_JAVA_EXECUTABLE) message( STATUS "Warning, could not run java -version") endif() else() - # extract major/minor version and patch level from "java -version" output - # Tested on linux using - # 1. Sun / Sun OEM - # 2. OpenJDK 1.6 - # 3. GCJ 1.5 - # 4. Kaffe 1.4.2 - # 5. OpenJDK 1.7.x on OpenBSD - if(var MATCHES "java version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\"") - # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer + # Extract version components (up to 4 levels) from "java -version" output. + set(_java_version_regex [[(([0-9]+)(\.([0-9]+)(\.([0-9]+)(_([0-9]+))?)?)?.*)]]) + if(var MATCHES "java version \"${_java_version_regex}\"") + # Sun, GCJ, older OpenJDK set(Java_VERSION_STRING "${CMAKE_MATCH_1}") + set(Java_VERSION_MAJOR "${CMAKE_MATCH_2}") + set(Java_VERSION_MINOR "${CMAKE_MATCH_4}") + set(Java_VERSION_PATCH "${CMAKE_MATCH_6}") + set(Java_VERSION_TWEAK "${CMAKE_MATCH_8}") + elseif(var MATCHES "openjdk version \"${_java_version_regex}\"") + # OpenJDK + set(Java_VERSION_STRING "${CMAKE_MATCH_1}") + set(Java_VERSION_MAJOR "${CMAKE_MATCH_2}") + set(Java_VERSION_MINOR "${CMAKE_MATCH_4}") + set(Java_VERSION_PATCH "${CMAKE_MATCH_6}") + set(Java_VERSION_TWEAK "${CMAKE_MATCH_8}") elseif(var MATCHES "openjdk version \"([0-9]+)-[A-Za-z]+\"") # OpenJDK 9 early access builds or locally built set(Java_VERSION_STRING "1.${CMAKE_MATCH_1}.0") - elseif(var MATCHES "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+)\"") + set(Java_VERSION_MAJOR "1") + set(Java_VERSION_MINOR "${CMAKE_MATCH_1}") + set(Java_VERSION_PATCH "0") + set(Java_VERSION_TWEAK "") + elseif(var MATCHES "java full version \"kaffe-${_java_version_regex}\"") # Kaffe style set(Java_VERSION_STRING "${CMAKE_MATCH_1}") - elseif(var MATCHES "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+.*)\"") - # OpenJDK ver 1.7.x on OpenBSD - set(Java_VERSION_STRING "${CMAKE_MATCH_1}") + set(Java_VERSION_MAJOR "${CMAKE_MATCH_2}") + set(Java_VERSION_MINOR "${CMAKE_MATCH_4}") + set(Java_VERSION_PATCH "${CMAKE_MATCH_6}") + set(Java_VERSION_TWEAK "${CMAKE_MATCH_8}") else() if(NOT Java_FIND_QUIETLY) - message(WARNING "regex not supported: ${var}. Please report") + string(REPLACE "\n" "\n " ver_msg "\n${var}") + message(WARNING "Java version not recognized:${ver_msg}\nPlease report.") endif() + set(Java_VERSION_STRING "") + set(Java_VERSION_MAJOR "") + set(Java_VERSION_MINOR "") + set(Java_VERSION_PATCH "") + set(Java_VERSION_TWEAK "") endif() - string( REGEX REPLACE "([0-9]+).*" "\\1" Java_VERSION_MAJOR "${Java_VERSION_STRING}" ) - string( REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_MINOR "${Java_VERSION_STRING}" ) - string( REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_PATCH "${Java_VERSION_STRING}" ) - # warning tweak version can be empty: - string( REGEX REPLACE "[0-9]+\\.[0-9]+\\.[0-9]+[_\\.]?([0-9]*).*$" "\\1" Java_VERSION_TWEAK "${Java_VERSION_STRING}" ) - if( Java_VERSION_TWEAK STREQUAL "" ) # check case where tweak is not defined - set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}) - else() - set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}.${Java_VERSION_TWEAK}) + set(Java_VERSION "${Java_VERSION_MAJOR}") + if(NOT "x${Java_VERSION}" STREQUAL "x") + foreach(c MINOR PATCH TWEAK) + if(NOT "x${Java_VERSION_${c}}" STREQUAL "x") + string(APPEND Java_VERSION ".${Java_VERSION_${c}}") + else() + break() + endif() + endforeach() endif() endif() @@ -254,7 +271,7 @@ else() find_package_handle_standard_args(Java REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE - VERSION_VAR Java_VERSION + VERSION_VAR Java_VERSION_STRING ) endif() diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index d287688..7d4ed6a 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -225,6 +225,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS) endif() set(MATLAB_VERSIONS_MAPPING + "R2017b=9.3" "R2017a=9.2" "R2016b=9.1" "R2016a=9.0" @@ -236,7 +237,6 @@ set(MATLAB_VERSIONS_MAPPING "R2013a=8.1" "R2012b=8.0" "R2012a=7.14" - "R2011b=7.13" "R2011a=7.12" "R2010b=7.11" diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index b8a7d82..ba87086 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -120,9 +120,12 @@ else() NAMES OpenCL PATHS ENV AMDAPPSDKROOT + ENV CUDA_PATH PATH_SUFFIXES lib/x86_64 - lib/x64) + lib/x64 + lib + lib64) endif() set(OpenCL_LIBRARIES ${OpenCL_LIBRARY}) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index d3e6782..a39a234 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -335,7 +335,11 @@ macro(_OPENMP_SET_VERSION_BY_SPEC_DATE LANG) "199710=1.0" ) - string(REGEX MATCHALL "${OpenMP_${LANG}_SPEC_DATE}=([0-9]+)\\.([0-9]+)" _version_match "${OpenMP_SPEC_DATE_MAP}") + if(OpenMP_${LANG}_SPEC_DATE) + string(REGEX MATCHALL "${OpenMP_${LANG}_SPEC_DATE}=([0-9]+)\\.([0-9]+)" _version_match "${OpenMP_SPEC_DATE_MAP}") + else() + set(_version_match "") + endif() if(NOT _version_match STREQUAL "") set(OpenMP_${LANG}_VERSION_MAJOR ${CMAKE_MATCH_1}) set(OpenMP_${LANG}_VERSION_MINOR ${CMAKE_MATCH_2}) @@ -414,7 +418,7 @@ unset(_OpenMP_MIN_VERSION) foreach(LANG IN LISTS OpenMP_FINDLIST) if(CMAKE_${LANG}_COMPILER_LOADED) - if (NOT OpenMP_${LANG}_SPEC_DATE) + if (NOT OpenMP_${LANG}_SPEC_DATE AND OpenMP_${LANG}_FLAGS) _OPENMP_GET_SPEC_DATE("${LANG}" OpenMP_${LANG}_SPEC_DATE_INTERNAL) set(OpenMP_${LANG}_SPEC_DATE "${OpenMP_${LANG}_SPEC_DATE_INTERNAL}" CACHE INTERNAL "${LANG} compiler's OpenMP specification date") diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 7292aec..e1a715e 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -101,7 +101,7 @@ # ``HDRS`` # Variable to define with autogenerated header files # ``DESCRIPTORS`` -# Variable to define with auotgenerated descriptor files, if requested. +# Variable to define with autogenerated descriptor files, if requested. # ``EXPORT_MACRO`` # is a macro which should expand to ``__declspec(dllexport)`` or # ``__declspec(dllimport)`` depending on what is being compiled. diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 63ec9a8..341d5d9 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -122,6 +122,7 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) if(WIN32) find_library(PYTHON_DEBUG_LIBRARY NAMES python${_CURRENT_VERSION_NO_DOTS}_d python + NAMES_PER_DIR HINTS ${_Python_LIBRARY_PATH_HINT} PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug @@ -145,20 +146,18 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) python${_CURRENT_VERSION}m python${_CURRENT_VERSION}u python${_CURRENT_VERSION} + NAMES_PER_DIR HINTS ${_Python_LIBRARY_PATH_HINT} PATHS ${PYTHON_FRAMEWORK_LIBRARIES} [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs - # Avoid finding the .dll in the PATH. We want the .lib. - NO_SYSTEM_ENVIRONMENT_PATH ) # Look for the static library in the Python config directory find_library(PYTHON_LIBRARY NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION} - # Avoid finding the .dll in the PATH. We want the .lib. - NO_SYSTEM_ENVIRONMENT_PATH + NAMES_PER_DIR # This is where the static library is usually located PATH_SUFFIXES python${_CURRENT_VERSION}/config ) diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake index f0b2583..e7ae919 100644 --- a/Modules/FindXMLRPC.cmake +++ b/Modules/FindXMLRPC.cmake @@ -43,20 +43,12 @@ endif() # Lookup the include directories needed for the components requested. if(XMLRPC_C_FOUND) - # Use the newer EXECUTE_PROCESS command if it is available. - if(COMMAND EXECUTE_PROCESS) - execute_process( - COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --cflags - OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT - ) - else() - exec_program(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --cflags" - OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS - RETURN_VALUE XMLRPC_C_CONFIG_RESULT - ) - endif() + execute_process( + COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --cflags + OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT + ) # Parse the include flags. if("${XMLRPC_C_CONFIG_RESULT}" STREQUAL "0") @@ -65,6 +57,7 @@ if(XMLRPC_C_FOUND) XMLRPC_C_CONFIG_CFLAGS "${XMLRPC_C_CONFIG_CFLAGS}") # Look for -I options. + # FIXME: Use these as hints to a find_path call to find the headers. set(XMLRPC_INCLUDE_DIRS) foreach(flag ${XMLRPC_C_CONFIG_CFLAGS}) if("${flag}" MATCHES "^-I(.+)") @@ -80,20 +73,12 @@ endif() # Lookup the libraries needed for the components requested. if(XMLRPC_C_FOUND) - # Use the newer EXECUTE_PROCESS command if it is available. - if(COMMAND EXECUTE_PROCESS) - execute_process( - COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --libs - OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT - ) - else() - exec_program(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --libs" - OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS - RETURN_VALUE XMLRPC_C_CONFIG_RESULT - ) - endif() + execute_process( + COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --libs + OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT + ) # Parse the library names and directories. if("${XMLRPC_C_CONFIG_RESULT}" STREQUAL "0") @@ -139,5 +124,5 @@ endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS( XMLRPC - REQUIRED_VARS XMLRPC_C_FOUND XMLRPC_LIBRARIES XMLRPC_INCLUDE_DIRS + REQUIRED_VARS XMLRPC_C_FOUND XMLRPC_LIBRARIES FAIL_MESSAGE "XMLRPC was not found. Make sure the entries XMLRPC_* are set.") diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 1182875..5e06adc 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -481,6 +481,8 @@ function(add_jar _TARGET_NAME) else() get_filename_component(_add_jar_OUTPUT_DIR ${_add_jar_OUTPUT_DIR} ABSOLUTE) endif() + # ensure output directory exists + file (MAKE_DIRECTORY "${_add_jar_OUTPUT_DIR}") if (_add_jar_ENTRY_POINT) set(_ENTRY_POINT_OPTION e) @@ -515,7 +517,7 @@ function(add_jar _TARGET_NAME) string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") endforeach() - set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${_add_jar_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") + set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar") if (_add_jar_OUTPUT_NAME AND _add_jar_VERSION) @@ -546,7 +548,7 @@ function(add_jar _TARGET_NAME) list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL}) elseif (_JAVA_EXT MATCHES ".java") - file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL}) + file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR} ${_JAVA_FULL}) file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL}) string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN) string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN) |