summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake1
-rw-r--r--Modules/CMakeFindBinUtils.cmake18
-rw-r--r--Modules/CPack.cmake2
-rw-r--r--Modules/CPackComponent.cmake6
-rw-r--r--Modules/Compiler/IAR-ASM.cmake2
-rw-r--r--Modules/Compiler/IAR-C.cmake6
-rw-r--r--Modules/Compiler/IAR-CXX.cmake6
-rw-r--r--Modules/ExternalProject.cmake5
-rw-r--r--Modules/FindBoost.cmake10
-rw-r--r--Modules/FindDoxygen.cmake5
-rw-r--r--Modules/FindMPI.cmake2
-rw-r--r--Modules/FindMatlab.cmake15
-rw-r--r--Modules/FindOpenThreads.cmake12
-rw-r--r--Modules/FindSubversion.cmake33
-rw-r--r--Modules/Findosg_functions.cmake22
-rw-r--r--Modules/GoogleTest.cmake2
-rw-r--r--Modules/ProcessorCount.cmake2
17 files changed, 88 insertions, 61 deletions
diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
index 55e0373..11f4a29 100644
--- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
+++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
@@ -27,6 +27,7 @@ macro(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines
set(_compilerExecutable "${CMAKE_C_COMPILER}")
set(_arg1 "${CMAKE_C_COMPILER_ARG1}")
endif ()
+ separate_arguments(_arg1 NATIVE_COMMAND "${_arg1}")
execute_process(COMMAND ${_compilerExecutable} ${_arg1} ${_stdver} ${_stdlib} -v -E -x ${_lang} -dD dummy
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles
ERROR_VARIABLE _gccOutput
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 1b6823c..830639d 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -38,6 +38,8 @@ if(CMAKE_LINKER)
endif()
endif()
+set(_CMAKE_TOOL_VARS "")
+
# if it's the MS C/CXX compiler, search for link
if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xMSVC"
@@ -47,7 +49,7 @@ if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC"
find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- mark_as_advanced(CMAKE_LINKER)
+ list(APPEND _CMAKE_TOOL_VARS CMAKE_LINKER)
# in all other cases search for ar, ranlib, etc.
else()
@@ -70,7 +72,7 @@ else()
find_program(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- mark_as_advanced(CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER CMAKE_NM CMAKE_OBJDUMP CMAKE_OBJCOPY)
+ list(APPEND _CMAKE_TOOL_VARS CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER CMAKE_NM CMAKE_OBJDUMP CMAKE_OBJCOPY)
endif()
@@ -81,5 +83,15 @@ if(CMAKE_PLATFORM_HAS_INSTALLNAME)
message(FATAL_ERROR "Could not find install_name_tool, please check your installation.")
endif()
- mark_as_advanced(CMAKE_INSTALL_NAME_TOOL)
+ list(APPEND _CMAKE_TOOL_VARS CMAKE_INSTALL_NAME_TOOL)
endif()
+
+# Mark any tool cache entries as advanced.
+foreach(var IN LISTS _CMAKE_TOOL_VARS)
+ get_property(_CMAKE_TOOL_CACHED CACHE ${var} PROPERTY TYPE)
+ if(_CMAKE_TOOL_CACHED)
+ mark_as_advanced(${var})
+ endif()
+endforeach()
+unset(_CMAKE_TOOL_VARS)
+unset(_CMAKE_TOOL_CACHED)
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index cdc38a6..f3e3423 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -19,7 +19,7 @@ command (and the deprecated :command:`install_files`,
:command:`install_programs` and :command:`install_targets` commands).
For certain kinds of binary installers (including the graphical
-installers on Mac OS X and Windows), CPack generates installers that
+installers on macOS and Windows), CPack generates installers that
allow users to select individual application components to install.
See :module:`CPackComponent` module for further details.
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake
index 6c122e5..a0d9935 100644
--- a/Modules/CPackComponent.cmake
+++ b/Modules/CPackComponent.cmake
@@ -14,7 +14,7 @@
# part of CPack. See CPack module for general information about CPack.
#
# For certain kinds of binary installers (including the graphical
-# installers on Mac OS X and Windows), CPack generates installers that
+# installers on macOS and Windows), CPack generates installers that
# allow users to select individual application components to install.
# The contents of each of the components are identified by the COMPONENT
# argument of CMake's INSTALL command. These components can be
@@ -283,8 +283,8 @@
#
#
#
-# On Mac OS X, installers that download components on-the-fly can only
-# be built and installed on system using Mac OS X 10.5 or later.
+# On macOS, installers that download components on-the-fly can only
+# be built and installed on system using macOS 10.5 or later.
#
# The site argument is a URL where the archives for downloadable
# components will reside, e.g.,
diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake
index 651bc3a..e12bfd1 100644
--- a/Modules/Compiler/IAR-ASM.cmake
+++ b/Modules/Compiler/IAR-ASM.cmake
@@ -18,4 +18,6 @@ elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
__compiler_iar_AVR(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;asm;msa)
+else()
+ message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic.")
endif()
diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake
index 55e019e..2ed8818 100644
--- a/Modules/Compiler/IAR-C.cmake
+++ b/Modules/Compiler/IAR-C.cmake
@@ -5,6 +5,9 @@ include(Compiler/CMakeCommonCompilerMacros)
# The toolchains for ARM and AVR are quite different:
if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
+ if(NOT CMAKE_C_COMPILER_VERSION)
+ message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.")
+ endif()
set(CMAKE_C_EXTENSION_COMPILE_OPTION -e)
@@ -40,4 +43,7 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH)
get_filename_component(_compilerDir "${_compilerDir}" PATH)
include_directories("${_compilerDir}/inc" )
+
+else()
+ message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic.")
endif()
diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake
index 8d86100..5b783b2 100644
--- a/Modules/Compiler/IAR-CXX.cmake
+++ b/Modules/Compiler/IAR-CXX.cmake
@@ -10,6 +10,9 @@ if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
#
# --c++ is full C++ and supported since 6.10
if(NOT CMAKE_IAR_CXX_FLAG)
+ if(NOT CMAKE_CXX_COMPILER_VERSION)
+ message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.")
+ endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.10)
set(CMAKE_IAR_CXX_FLAG --c++)
else()
@@ -48,4 +51,7 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH)
get_filename_component(_compilerDir "${_compilerDir}" PATH)
include_directories("${_compilerDir}/inc")
+
+else()
+ message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic." )
endif()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 0c5b33f..f987d2d 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -934,6 +934,11 @@ function(_ep_parse_arguments f name ns args)
# We loop through ARGN and consider the namespace starting with an
# upper-case letter followed by at least two more upper-case letters,
# numbers or underscores to be keywords.
+
+ if(NOT DEFINED _ExternalProject_SELF)
+ message(FATAL_ERROR "error: ExternalProject module must be explicitly included before using ${f} function")
+ endif()
+
set(key)
foreach(arg IN LISTS args)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index c14e402..24ee1f2 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -493,11 +493,11 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
if(Boost_MINOR_VERSION)
if(${Boost_MINOR_VERSION} GREATER 35)
# In Boost 1.36.0 and newer, the mangled compiler name used
- # on Mac OS X/Darwin is "xgcc".
+ # on macOS/Darwin is "xgcc".
set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
else()
# In Boost <= 1.35.0, there is no mangled compiler name for
- # the Mac OS X/Darwin version of GCC.
+ # the macOS/Darwin version of GCC.
set(_boost_COMPILER "")
endif()
else()
@@ -881,7 +881,11 @@ function(_Boost_COMPONENT_HEADERS component _hdrs)
set(_Boost_CHRONO_HEADERS "boost/chrono.hpp")
set(_Boost_CONTAINER_HEADERS "boost/container/container_fwd.hpp")
set(_Boost_CONTRACT_HEADERS "boost/contract.hpp")
- set(_Boost_CONTEXT_HEADERS "boost/context/detail/fcontext.hpp")
+ if(Boost_VERSION VERSION_LESS 106100)
+ set(_Boost_CONTEXT_HEADERS "boost/context/all.hpp")
+ else()
+ set(_Boost_CONTEXT_HEADERS "boost/context/detail/fcontext.hpp")
+ endif()
set(_Boost_COROUTINE_HEADERS "boost/coroutine/all.hpp")
set(_Boost_DATE_TIME_HEADERS "boost/date_time/date.hpp")
set(_Boost_EXCEPTION_HEADERS "boost/exception/exception.hpp")
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index 945ee0e..2ed9449 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -370,6 +370,9 @@ Deprecated Hint Variables
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
# For backwards compatibility support
if(Doxygen_FIND_QUIETLY)
set(DOXYGEN_FIND_QUIETLY TRUE)
@@ -1108,3 +1111,5 @@ doxygen_add_docs() for target ${targetName}")
)
endfunction()
+
+cmake_policy(POP)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 75c4441..bfcd876 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1680,7 +1680,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}")
unset(MPI_${LANG}_COMPILE_FLAGS)
if(MPI_${LANG}_COMPILE_OPTIONS)
- set(MPI_${LANG}_COMPILE_FLAGS "${MPI_${LANG}_COMPILE_OPTIONS}")
+ list(JOIN MPI_${LANG}_COMPILE_FLAGS " " MPI_${LANG}_COMPILE_OPTIONS)
endif()
if(MPI_${LANG}_COMPILE_DEFINITIONS)
foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS)
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index f2ada3b..12a2f75 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -1224,21 +1224,6 @@ function(_Matlab_find_instances_win32 matlab_roots)
# filtering the results with the registry keys
matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots)
- unset(_matlab_versions_from_registry)
-
- set(_matlab_versions_from_registry)
- matlab_extract_all_installed_versions_from_registry(CMAKE_CL_64 _matlab_versions_from_registry)
-
- # the returned list is empty, doing the search on all known versions
- if(NOT _matlab_versions_from_registry)
- if(MATLAB_FIND_DEBUG)
- message(STATUS "[MATLAB] Search for Matlab from the registry unsuccessful, testing all supported versions")
- endif()
- extract_matlab_versions_from_registry_brute_force(_matlab_versions_from_registry)
- endif()
-
- # filtering the results with the registry keys
- matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots)
set(${matlab_roots} ${_matlab_possible_roots} PARENT_SCOPE)
endfunction()
diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake
index a197e4d..91545e0 100644
--- a/Modules/FindOpenThreads.cmake
+++ b/Modules/FindOpenThreads.cmake
@@ -47,6 +47,8 @@
# standard install paths.
# Explicit -DVAR=value arguments should still be able to override everything.
+include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+
find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
HINTS
ENV OPENTHREADS_INCLUDE_DIR
@@ -62,7 +64,7 @@ find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
)
-find_library(OPENTHREADS_LIBRARY
+find_library(OPENTHREADS_LIBRARY_RELEASE
NAMES OpenThreads OpenThreadsWin32
HINTS
ENV OPENTHREADS_LIBRARY_DIR
@@ -93,13 +95,7 @@ find_library(OPENTHREADS_LIBRARY_DEBUG
PATH_SUFFIXES lib
)
-if(OPENTHREADS_LIBRARY_DEBUG)
- set(OPENTHREADS_LIBRARIES
- optimized ${OPENTHREADS_LIBRARY}
- debug ${OPENTHREADS_LIBRARY_DEBUG})
-else()
- set(OPENTHREADS_LIBRARIES ${OPENTHREADS_LIBRARY})
-endif()
+select_library_configurations(OPENTHREADS)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenThreads DEFAULT_MSG
diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake
index 537d3b2..e18ae88 100644
--- a/Modules/FindSubversion.cmake
+++ b/Modules/FindSubversion.cmake
@@ -19,17 +19,21 @@
#
#
# The minimum required version of Subversion can be specified using the
-# standard syntax, e.g. find_package(Subversion 1.4)
+# standard syntax, e.g. ``find_package(Subversion 1.4)``.
#
# If the command line client executable is found two macros are defined:
#
# ::
#
-# Subversion_WC_INFO(<dir> <var-prefix>)
+# Subversion_WC_INFO(<dir> <var-prefix> [IGNORE_SVN_FAILURE])
# Subversion_WC_LOG(<dir> <var-prefix>)
#
-# Subversion_WC_INFO extracts information of a subversion working copy
-# at a given location. This macro defines the following variables:
+# ``Subversion_WC_INFO`` extracts information of a subversion working copy at a
+# given location. This macro defines the following variables if running
+# Subversion's ``info`` command on ``<dir>`` succeeds; otherwise a
+# ``SEND_ERROR`` message is generated. The error can be ignored by providing the
+# ``IGNORE_SVN_FAILURE`` option, which causes these variables to remain
+# undefined.
#
# ::
#
@@ -41,9 +45,8 @@
# <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit
# <var-prefix>_WC_INFO - output of command `svn info <dir>'
#
-# Subversion_WC_LOG retrieves the log message of the base revision of a
-# subversion working copy at a given location. This macro defines the
-# variable:
+# ``Subversion_WC_LOG`` retrieves the log message of the base revision of a
+# subversion working copy at a given location. This macro defines the variable:
#
# ::
#
@@ -84,6 +87,14 @@ if(Subversion_SVN_EXECUTABLE)
"\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}")
macro(Subversion_WC_INFO dir prefix)
+
+ cmake_parse_arguments(
+ "Subversion_WC_INFO"
+ "IGNORE_SVN_FAILURE"
+ "" ""
+ ${ARGN}
+ )
+
# the subversion commands should be executed with the C locale, otherwise
# the message (which are parsed) may be translated, Alex
set(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}")
@@ -95,10 +106,7 @@ if(Subversion_SVN_EXECUTABLE)
RESULT_VARIABLE Subversion_svn_info_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(NOT ${Subversion_svn_info_result} EQUAL 0)
- message(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} info ${dir}\" failed with output:\n${Subversion_svn_info_error}")
- else()
-
+ if(${Subversion_svn_info_result} EQUAL 0)
string(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*"
"\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*"
@@ -111,7 +119,8 @@ if(Subversion_SVN_EXECUTABLE)
"\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*"
"\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}")
-
+ elseif(NOT Subversion_WC_INFO_IGNORE_SVN_FAILURE)
+ message(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} info ${dir}\" failed with output:\n${Subversion_svn_info_error}")
endif()
# restore the previous LC_ALL
diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake
index 60de726..adaeb6b 100644
--- a/Modules/Findosg_functions.cmake
+++ b/Modules/Findosg_functions.cmake
@@ -13,6 +13,8 @@
# libraries and nodekits. Please see FindOpenSceneGraph.cmake for full
# documentation.
+include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+
#
# OSG_FIND_PATH
#
@@ -39,7 +41,7 @@ endfunction()
function(OSG_FIND_LIBRARY module library)
string(TOUPPER ${module} module_uc)
- find_library(${module_uc}_LIBRARY
+ find_library(${module_uc}_LIBRARY_RELEASE
NAMES ${library}
HINTS
ENV ${module_uc}_DIR
@@ -63,18 +65,12 @@ function(OSG_FIND_LIBRARY module library)
PATH_SUFFIXES lib
)
- if(NOT ${module_uc}_LIBRARY_DEBUG)
- # They don't have a debug library
- set(${module_uc}_LIBRARY_DEBUG ${${module_uc}_LIBRARY} PARENT_SCOPE)
- set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE)
- else()
- # They really have a FOO_LIBRARY_DEBUG
- set(${module_uc}_LIBRARIES
- optimized ${${module_uc}_LIBRARY}
- debug ${${module_uc}_LIBRARY_DEBUG}
- PARENT_SCOPE
- )
- endif()
+ select_library_configurations(${module_uc})
+
+ # the variables set by select_library_configurations go out of scope
+ # here, so we need to set them again
+ set(${module_uc}_LIBRARY ${${module_uc}_LIBRARY} PARENT_SCOPE)
+ set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARIES} PARENT_SCOPE)
endfunction()
#
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake
index 2c9ee11..a5bb863 100644
--- a/Modules/GoogleTest.cmake
+++ b/Modules/GoogleTest.cmake
@@ -308,7 +308,7 @@ function(gtest_add_tests)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${source})
endif()
file(READ "${source}" contents)
- string(REGEX MATCHALL "${gtest_test_type_regex} *\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
+ string(REGEX MATCHALL "${gtest_test_type_regex} *\\(([A-Za-z_0-9 ,]+)\\)" found_tests "${contents}")
foreach(hit ${found_tests})
string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit})
diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index 772a615..8a37884 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -12,7 +12,7 @@
# Sets the variable named ${var} to the number of physical cores
# available on the machine if the information can be determined.
# Otherwise it is set to 0. Currently this functionality is implemented
-# for AIX, cygwin, FreeBSD, HPUX, IRIX, Linux, Mac OS X, QNX, Sun and
+# for AIX, cygwin, FreeBSD, HPUX, IRIX, Linux, macOS, QNX, Sun and
# Windows.
#
# This function is guaranteed to return a positive integer (>=1) if it