diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 4 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 4 | ||||
-rw-r--r-- | Modules/CTest.cmake | 3 | ||||
-rw-r--r-- | Modules/Compiler/QCC-C-FeatureTests.cmake | 1 | ||||
-rw-r--r-- | Modules/Compiler/QCC-C.cmake | 3 | ||||
-rw-r--r-- | Modules/Compiler/QCC-CXX-FeatureTests.cmake | 1 | ||||
-rw-r--r-- | Modules/Compiler/QCC-CXX.cmake | 3 | ||||
-rw-r--r-- | Modules/DartConfiguration.tcl.in | 5 | ||||
-rw-r--r-- | Modules/FindCUDA/select_compute_arch.cmake | 18 | ||||
-rw-r--r-- | Modules/FindCURL.cmake | 77 | ||||
-rw-r--r-- | Modules/FindHDF5.cmake | 2 | ||||
-rw-r--r-- | Modules/FindOctave.cmake | 167 | ||||
-rw-r--r-- | Modules/FindThreads.cmake | 16 | ||||
-rw-r--r-- | Modules/UseEcos.cmake | 4 | ||||
-rw-r--r-- | Modules/UseSWIG.cmake | 25 |
15 files changed, 308 insertions, 25 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 17706ea..1a0d8a6 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -136,7 +136,7 @@ endif () # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC") get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) @@ -145,7 +145,7 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-) endif() elseif(COMPILER_BASENAME MATCHES "qcc(\\.exe)?$") - if(CMAKE_C_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?") + if(CMAKE_C_COMPILER_TARGET MATCHES "gcc_nto([a-z0-9]+_[0-9]+|[^_le]+)(le)?") set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-) endif() endif () diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 70d17a1..0a0c37b 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -133,7 +133,7 @@ endif () if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) - if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC") get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME) if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) @@ -142,7 +142,7 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-) endif() elseif(COMPILER_BASENAME MATCHES "QCC(\\.exe)?$") - if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?") + if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([a-z0-9]+_[0-9]+|[^_le]+)(le)") set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-) endif() endif () diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index 18bb452..8848bdd 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -177,9 +177,6 @@ if(BUILD_TESTING) ) set(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH "File that contains suppressions for the memory checker") - find_program(SCPCOMMAND scp DOC - "Path to scp command, used by CTest for submitting results to a Dart server" - ) find_program(COVERAGE_COMMAND gcov DOC "Path to the coverage program that CTest uses for performing coverage inspection" ) diff --git a/Modules/Compiler/QCC-C-FeatureTests.cmake b/Modules/Compiler/QCC-C-FeatureTests.cmake new file mode 100644 index 0000000..68f4197 --- /dev/null +++ b/Modules/Compiler/QCC-C-FeatureTests.cmake @@ -0,0 +1 @@ +include(Compiler/GNU-C-FeatureTests) diff --git a/Modules/Compiler/QCC-C.cmake b/Modules/Compiler/QCC-C.cmake index ae4a2f4..6db619e 100644 --- a/Modules/Compiler/QCC-C.cmake +++ b/Modules/Compiler/QCC-C.cmake @@ -1,2 +1,5 @@ +# To include compiler feature detection +include(Compiler/GNU-C) + include(Compiler/QCC) __compiler_qcc(C) diff --git a/Modules/Compiler/QCC-CXX-FeatureTests.cmake b/Modules/Compiler/QCC-CXX-FeatureTests.cmake new file mode 100644 index 0000000..c836b94 --- /dev/null +++ b/Modules/Compiler/QCC-CXX-FeatureTests.cmake @@ -0,0 +1 @@ +include(Compiler/GNU-CXX-FeatureTests) diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake index e86d1fa..0e7314a 100644 --- a/Modules/Compiler/QCC-CXX.cmake +++ b/Modules/Compiler/QCC-CXX.cmake @@ -1,3 +1,6 @@ +# To include compiler feature detection +include(Compiler/GNU-CXX) + include(Compiler/QCC) __compiler_qcc(CXX) diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index b86a5a9..24e7b55 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -20,17 +20,12 @@ BuildName: @BUILDNAME@ LabelsForSubprojects: @CTEST_LABELS_FOR_SUBPROJECTS@ # Submission information -IsCDash: @CTEST_DROP_SITE_CDASH@ -CDashVersion: @CTEST_CDASH_VERSION@ -QueryCDashVersion: @CTEST_CDASH_QUERY_VERSION@ DropSite: @DROP_SITE@ DropLocation: @DROP_LOCATION@ DropSiteUser: @DROP_SITE_USER@ DropSitePassword: @DROP_SITE_PASSWORD@ DropSiteMode: @DROP_SITE_MODE@ DropMethod: @DROP_METHOD@ -TriggerSite: @TRIGGER_SITE@ -ScpCommand: @SCPCOMMAND@ # Dashboard start time NightlyStartTime: @NIGHTLY_START_TIME@ diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake index 1baf051..7ddb709 100644 --- a/Modules/FindCUDA/select_compute_arch.cmake +++ b/Modules/FindCUDA/select_compute_arch.cmake @@ -5,9 +5,9 @@ # - "Auto" detects local machine GPU compute arch at runtime. # - "Common" and "All" cover common and entire subsets of architectures # ARCH_AND_PTX : NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX -# NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal +# NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal Volta Turing # NUM: Any number. Only those pairs are currently accepted by NVCC though: -# 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2 +# 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2 7.0 7.2 7.5 # Returns LIST of flags to be added to CUDA_NVCC_FLAGS in ${out_variable} # Additionally, sets ${out_variable}_readable to the resulting numeric list # Example: @@ -63,12 +63,23 @@ endif () if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0") list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Volta") list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "7.0" "7.0+PTX") + list(APPEND CUDA_ALL_GPU_ARCHITECTURES "7.0" "7.0+PTX" "7.2" "7.2+PTX") if(CUDA_VERSION VERSION_LESS "10.0") set(CUDA_LIMIT_GPU_ARCHITECTURE "8.0") endif() endif() +if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0") + list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Turing") + list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "7.5" "7.5+PTX") + list(APPEND CUDA_ALL_GPU_ARCHITECTURES "7.5" "7.5+PTX") + + if(CUDA_VERSION VERSION_LESS "11.0") + set(CUDA_LIMIT_GPU_ARCHITECTURE "9.0") + endif() +endif() + ################################################################################################ # A function for automatic detection of GPUs installed (if autodetection is enabled) # Usage: @@ -200,6 +211,9 @@ function(CUDA_SELECT_NVCC_ARCH_FLAGS out_variable) elseif(${arch_name} STREQUAL "Volta") set(arch_bin 7.0 7.0) set(arch_ptx 7.0) + elseif(${arch_name} STREQUAL "Turing") + set(arch_bin 7.5) + set(arch_ptx 7.5) else() message(SEND_ERROR "Unknown CUDA Architecture Name ${arch_name} in CUDA_SELECT_NVCC_ARCH_FLAGS") endif() diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index a4b238d..d28dfea 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -7,6 +7,14 @@ FindCURL Find the native CURL headers and libraries. +This module accept optional COMPONENTS to check supported features and +protocols:: + + PROTOCOLS: ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 + POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP + FEATURES: SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO + Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy + IMPORTED Targets ^^^^^^^^^^^^^^^^ @@ -31,8 +39,20 @@ This module defines the following variables: The version of curl found. #]=======================================================================] +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_CURL QUIET libcurl) + if(PC_CURL_FOUND) + set(CURL_VERSION_STRING ${PC_CURL_VERSION}) + pkg_get_variable(CURL_SUPPORTED_PROTOCOLS libcurl supported_protocols) + pkg_get_variable(CURL_SUPPORTED_FEATURES libcurl supported_features) + endif() +endif() + # Look for the header file. -find_path(CURL_INCLUDE_DIR NAMES curl/curl.h) +find_path(CURL_INCLUDE_DIR + NAMES curl/curl.h + HINTS ${PC_CURL_INCLUDE_DIRS}) mark_as_advanced(CURL_INCLUDE_DIR) if(NOT CURL_LIBRARY) @@ -45,6 +65,7 @@ if(NOT CURL_LIBRARY) curllib_static # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): libcurl + HINTS ${PC_CURL_LIBRARY_DIRS} ) mark_as_advanced(CURL_LIBRARY_RELEASE) @@ -52,6 +73,7 @@ if(NOT CURL_LIBRARY) # Windows MSVC CMake builds in debug configuration on vcpkg: libcurl-d_imp libcurl-d + HINTS ${PC_CURL_LIBRARY_DIRS} ) mark_as_advanced(CURL_LIBRARY_DEBUG) @@ -59,7 +81,7 @@ if(NOT CURL_LIBRARY) select_library_configurations(CURL) endif() -if(CURL_INCLUDE_DIR) +if(CURL_INCLUDE_DIR AND NOT CURL_VERSION_STRING) foreach(_curl_version_header curlver.h curl.h) if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}") file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"") @@ -71,10 +93,57 @@ if(CURL_INCLUDE_DIR) endforeach() endif() +if(CURL_FIND_COMPONENTS) + set(CURL_KNOWN_PROTOCOLS ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP) + set(CURL_KNOWN_FEATURES SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy) + foreach(component IN LISTS CURL_KNOWN_PROTOCOLS CURL_KNOWN_FEATURES) + set(CURL_${component}_FOUND FALSE) + endforeach() + if(NOT PC_CURL_FOUND) + find_program(CURL_CONFIG_EXECUTABLE NAMES curl-config) + if(CURL_CONFIG_EXECUTABLE) + execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE CURL_CONFIG_VERSION_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --feature + OUTPUT_VARIABLE CURL_CONFIG_FEATURES_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REPLACE "\n" ";" CURL_CONFIG_FEATURES "${CURL_CONFIG_FEATURES_STRING}") + execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --protocols + OUTPUT_VARIABLE CURL_CONFIG_PROTOCOLS_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REPLACE "\n" ";" CURL_CONFIG_PROTOCOLS "${CURL_CONFIG_PROTOCOLS_STRING}") + endif() + + endif() + foreach(component IN LISTS CURL_FIND_COMPONENTS) + list(FIND CURL_KNOWN_PROTOCOLS ${component} _found) + if(_found) + list(FIND CURL_SUPPORTED_PROTOCOLS ${component} _found) + if(_found) + set(CURL_${component}_FOUND TRUE) + elseif(CURL_FIND_REQUIRED) + message(FATAL_ERROR "CURL: Required protocol ${component} is not found") + endif() + else() + list(FIND CURL_SUPPORTED_FEATURES ${component} _found) + if(_found) + set(CURL_${component}_FOUND TRUE) + elseif(CURL_FIND_REQUIRED) + message(FATAL_ERROR "CURL: Required feature ${component} is not found") + endif() + endif() + endforeach() +endif() + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL +find_package_handle_standard_args(CURL REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR - VERSION_VAR CURL_VERSION_STRING) + VERSION_VAR CURL_VERSION_STRING + HANDLE_COMPONENTS) if(CURL_FOUND) set(CURL_LIBRARIES ${CURL_LIBRARY}) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index e36767a..2772b7d 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -818,7 +818,7 @@ if( NOT HDF5_FOUND ) set( THIS_LIBRARY_SEARCH_DEBUG lib${LIB}d.a lib${LIB}_debug.a lib${LIB}d lib${LIB}_D lib${LIB}_debug lib${LIB}d-static.a lib${LIB}_debug-static.a lib${LIB}d-static lib${LIB}_D-static lib${LIB}_debug-static ) - set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} lib${LIB}-static.a lib${LIB}-static) + set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a lib${LIB} lib${LIB}-static.a lib${LIB}-static) else() set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_D ${LIB}_debug ${LIB}d-shared ${LIB}_D-shared ${LIB}_debug-shared) set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared) diff --git a/Modules/FindOctave.cmake b/Modules/FindOctave.cmake new file mode 100644 index 0000000..8ae6a47 --- /dev/null +++ b/Modules/FindOctave.cmake @@ -0,0 +1,167 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindOctave +---------- + +Finds GNU Octave interpreter, libraries and compilers. + +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``Octave::Interpreter`` + Octave interpreter (the main program) +``Octave::Octave`` + include directories and libraries + +If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. + +Result Variables +^^^^^^^^^^^^^^^^ + +``Octave_FOUND`` + Octave interpreter and/or libraries were found +``Octave_<component>_FOUND`` + Octave <component> specified was found + +``Octave_EXECUTABLE`` + Octave interpreter +``Octave_INCLUDE_DIRS`` + include path for mex.h +``Octave_LIBRARIES`` + octinterp, octave libraries + + +Cache variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Octave_INTERP_LIBRARY`` + path to the library octinterp +``Octave_OCTAVE_LIBRARY`` + path to the liboctave library + +#]=======================================================================] + +cmake_policy(VERSION 3.3) + +unset(Octave_REQUIRED_VARS) +unset(Octave_Development_FOUND) +unset(Octave_Interpreter_FOUND) +set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME Interpreter) + +if(Development IN_LIST Octave_FIND_COMPONENTS) + find_program(Octave_CONFIG_EXECUTABLE + NAMES octave-config) + + if(Octave_CONFIG_EXECUTABLE) + + execute_process(COMMAND ${Octave_CONFIG_EXECUTABLE} -p BINDIR + OUTPUT_VARIABLE Octave_BINARY_DIR + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + execute_process(COMMAND ${Octave_CONFIG_EXECUTABLE} -p OCTINCLUDEDIR + OUTPUT_VARIABLE Octave_INCLUDE_DIR + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + list(APPEND Octave_REQUIRED_VARS ${Octave_INCLUDE_DIR}) + + execute_process(COMMAND ${Octave_CONFIG_EXECUTABLE} -p OCTLIBDIR + OUTPUT_VARIABLE Octave_LIB1 + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + execute_process(COMMAND ${Octave_CONFIG_EXECUTABLE} -p LIBDIR + OUTPUT_VARIABLE Octave_LIB2 + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + find_library(Octave_INTERP_LIBRARY + NAMES octinterp + PATHS ${Octave_LIB1} ${Octave_LIB2} + NO_DEFAULT_PATH + ) + find_library(Octave_OCTAVE_LIBRARY + NAMES octave + PATHS ${Octave_LIB1} ${Octave_LIB2} + NO_DEFAULT_PATH + ) + list(APPEND Octave_REQUIRED_VARS ${Octave_OCTAVE_LIBRARY} ${Octave_INTERP_LIBRARY}) + + if(Octave_REQUIRED_VARS) + set(Octave_Development_FOUND true) + endif() + endif(Octave_CONFIG_EXECUTABLE) +endif() + +if(Interpreter IN_LIST Octave_FIND_COMPONENTS) + + find_program(Octave_EXECUTABLE + NAMES octave) + + list(APPEND Octave_REQUIRED_VARS ${Octave_EXECUTABLE}) + +endif() + +if(Octave_EXECUTABLE) + execute_process(COMMAND ${Octave_EXECUTABLE} -v + OUTPUT_VARIABLE Octave_VERSION + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + + string(REGEX REPLACE "GNU Octave, version ([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" Octave_VERSION_MAJOR ${Octave_VERSION}) + string(REGEX REPLACE "GNU Octave, version [0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" Octave_VERSION_MINOR ${Octave_VERSION}) + string(REGEX REPLACE "GNU Octave, version [0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" Octave_VERSION_PATCH ${Octave_VERSION}) + + set(Octave_VERSION ${Octave_VERSION_MAJOR}.${Octave_VERSION_MINOR}.${Octave_VERSION_PATCH}) + + set(Octave_Interpreter_FOUND true) + +endif(Octave_EXECUTABLE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Octave + REQUIRED_VARS Octave_REQUIRED_VARS + VERSION_VAR Octave_VERSION + HANDLE_COMPONENTS) + + +if(Octave_Development_FOUND) + set(Octave_LIBRARIES ${Octave_INTERP_LIBRARY} ${Octave_OCTAVE_LIBRARY}) + set(Octave_INCLUDE_DIRS ${Octave_INCLUDE_DIR}) + + if(NOT TARGET Octave::Octave) + add_library(Octave::Octave UNKNOWN IMPORTED) + set_target_properties(Octave::Octave PROPERTIES + IMPORTED_LOCATION ${Octave_OCTAVE_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${Octave_INCLUDE_DIR} + ) + endif() + +endif() + + +if(Octave_Interpreter_FOUND) + if(NOT TARGET Octave::Interpreter) + add_executable(Octave::Interpreter IMPORTED) + set_target_properties(Octave::Interpreter PROPERTIES + IMPORTED_LOCATION ${Octave_EXECUTABLE} + VERSION ${Octave_VERSION}) + endif() +endif() + +mark_as_advanced( + Octave_CONFIG_EXECUTABLE + Octave_INTERP_LIBRARY + Octave_OCTAVE_LIBRARY + Octave_INCLUDE_DIR + Octave_VERSION_MAJOR + Octave_VERSION_MINOR + Octave_VERSION_PATCH +) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index dfb683f..691b1b7 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -131,9 +131,17 @@ else() # set(CMAKE_HAVE_THREADS_LIBRARY) if(NOT THREADS_HAVE_PTHREAD_ARG) - # Check if pthread functions are in normal C library - CHECK_SYMBOL_EXISTS(pthread_create pthread.h CMAKE_HAVE_LIBC_CREATE) - if(CMAKE_HAVE_LIBC_CREATE) + # Check if pthread functions are in normal C library. + # If the pthread functions already exist in C library, we could just use + # them instead of linking to the additional pthread library. We could + # try to check any pthread symbol name, but here is an exception. If we + # use clang asan build, we will find the pthread_create() symbol in the + # libc(libasan). However, it doesn't have the full pthread implementation. + # So, we can't assume that we have the pthread implementation in libc + # using the pthread_create() checking here. Then, we turn to check the + # pthread_kill() symbol instead. + CHECK_SYMBOL_EXISTS(pthread_kill pthread.h CMAKE_HAVE_LIBC_PTHREAD_KILL) + if(CMAKE_HAVE_LIBC_PTHREAD_KILL) set(CMAKE_THREAD_LIBS_INIT "") set(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) @@ -159,7 +167,7 @@ else() endif() endif() -if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE) +if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_PTHREAD_KILL) set(CMAKE_USE_PTHREADS_INIT 1) set(Threads_FOUND TRUE) endif() diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake index 6d13d42..9f84847 100644 --- a/Modules/UseEcos.cmake +++ b/Modules/UseEcos.cmake @@ -191,8 +191,8 @@ macro(ECOS_ADD_EXECUTABLE _exe_NAME ) set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") # some strict compiler flags - set (CMAKE_C_FLAGS "-Wstrict-prototypes") - set (CMAKE_CXX_FLAGS "-Woverloaded-virtual -fno-rtti -Wctor-dtor-privacy -fno-strict-aliasing -fno-exceptions") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual -fno-rtti -Wctor-dtor-privacy -fno-strict-aliasing -fno-exceptions") add_executable(${_exe_NAME} ${ARGN}) set_target_properties(${_exe_NAME} PROPERTIES SUFFIX ".elf") diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index d9a0389..a3d6d9e 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -142,6 +142,11 @@ ensure generated files will receive the required settings. set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname) + .. note:: + + If policy :policy:`CMP0086` is set to ``NEW``, ``-module <module_name>`` + is passed to ``SWIG`` compiler. + Target library properties can be set to apply same configuration to all SWIG input files. @@ -220,12 +225,19 @@ as well as ``SWIG``: #]=======================================================================] cmake_policy(GET CMP0078 target_name_policy) +cmake_policy(GET CMP0086 module_name_policy) + cmake_policy (VERSION 3.12) if (target_name_policy) # respect user choice regarding CMP0078 policy cmake_policy(SET CMP0078 ${target_name_policy}) endif() +if (module_name_policy) + # respect user choice regarding CMP0086 policy + cmake_policy(SET CMP0086 ${module_name_policy}) +endif() unset(target_name_policy) +unset(module_name_policy) set(SWIG_CXX_EXTENSION "cxx") set(SWIG_EXTRA_LIBRARIES "") @@ -426,6 +438,19 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) list (APPEND swig_special_flags "-c++") endif() + cmake_policy(GET CMP0086 module_name_policy) + if (module_name_policy STREQUAL "NEW") + get_source_file_property(module_name "${infile}" SWIG_MODULE_NAME) + if (module_name) + list (APPEND swig_special_flags "-module" "${module_name}") + endif() + else() + if (NOT module_name_policy) + cmake_policy(GET_WARNING CMP0086 _cmp0086_warning) + message(AUTHOR_WARNING "${_cmp0086_warning}\n") + endif() + endif() + set (swig_extra_flags) if(SWIG_MODULE_${name}_LANGUAGE STREQUAL "CSHARP") if(NOT ("-dllimport" IN_LIST swig_source_file_flags OR "-dllimport" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS)) |