summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Compiler/Flang-Fortran.cmake2
-rw-r--r--Modules/Compiler/QCC.cmake2
-rw-r--r--Modules/FindBLAS.cmake2
-rw-r--r--Modules/FindBoost.cmake55
-rw-r--r--Modules/FindLAPACK.cmake4
-rw-r--r--Modules/FindMPI.cmake7
-rw-r--r--Modules/FindPostgreSQL.cmake4
-rw-r--r--Modules/FindProtobuf.cmake36
-rw-r--r--Modules/Internal/CPack/CPackExternal.cmake (renamed from Modules/Internal/CPack/CPackExt.cmake)22
-rw-r--r--Modules/UseSWIG.cmake15
-rw-r--r--Modules/UseSWIG/ManageSupportFiles.cmake31
11 files changed, 124 insertions, 56 deletions
diff --git a/Modules/Compiler/Flang-Fortran.cmake b/Modules/Compiler/Flang-Fortran.cmake
index a1051f4..d522739 100644
--- a/Modules/Compiler/Flang-Fortran.cmake
+++ b/Modules/Compiler/Flang-Fortran.cmake
@@ -2,7 +2,7 @@ include(Compiler/Clang)
__compiler_clang(Fortran)
set(CMAKE_Fortran_PREPROCESS_SOURCE
- "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>")
+ "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake
index 9ba9900..9df8269 100644
--- a/Modules/Compiler/QCC.cmake
+++ b/Modules/Compiler/QCC.cmake
@@ -11,7 +11,7 @@ macro(__compiler_qcc lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V")
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,")
- set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MD,<DEPFILE>,-MT,<OBJECT>,-MF,<DEPFILE>")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-Wp,-MD,<DEPFILE> -Wp,-MT,<OBJECT> -Wp,-MF,<DEPFILE>")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index e955bc2..efcf355 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -222,7 +222,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
set(BLAS_SEARCH_LIBS "")
if(BLA_F95)
- set(BLAS_mkl_SEARCH_SYMBOL SGEMM)
+ set(BLAS_mkl_SEARCH_SYMBOL sgemm_f95)
set(_LIBRARIES BLAS95_LIBRARIES)
if (WIN32)
if (BLA_STATIC)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index da3d443..e983941 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -147,6 +147,9 @@
# used if multiple compatible suffixes should
# be tested for, in decreasing order of
# preference.
+# Boost_ARCHITECTURE - Set to the architecture-specific library suffix
+# (e.g. "-x64"). Default is auto-computed for the
+# C++ compiler in use.
# Boost_THREADAPI - Suffix for "thread" component library name,
# such as "pthread" or "win32". Names with
# and without this suffix will both be tried.
@@ -929,6 +932,12 @@ function(_Boost_COMPONENT_HEADERS component _hdrs)
set(_Boost_REGEX_HEADERS "boost/regex.hpp")
set(_Boost_SERIALIZATION_HEADERS "boost/serialization/serialization.hpp")
set(_Boost_SIGNALS_HEADERS "boost/signals.hpp")
+ set(_Boost_STACKTRACE_ADDR2LINE_HEADERS "boost/stacktrace.hpp")
+ set(_Boost_STACKTRACE_BACKTRACE_HEADERS "boost/stacktrace.hpp")
+ set(_Boost_STACKTRACE_BASIC_HEADERS "boost/stacktrace.hpp")
+ set(_Boost_STACKTRACE_NOOP_HEADERS "boost/stacktrace.hpp")
+ set(_Boost_STACKTRACE_WINDBG_CACHED_HEADERS "boost/stacktrace.hpp")
+ set(_Boost_STACKTRACE_WINDBG_HEADERS "boost/stacktrace.hpp")
set(_Boost_SYSTEM_HEADERS "boost/system/config.hpp")
set(_Boost_TEST_EXEC_MONITOR_HEADERS "boost/test/test_exec_monitor.hpp")
set(_Boost_THREAD_HEADERS "boost/thread.hpp")
@@ -1493,27 +1502,35 @@ endif()
# -x86 Architecture and address model tag
# First character is the architecture, then word-size, either 32 or 64
# Only used in 'versioned' layout, added in Boost 1.66.0
-set(_boost_ARCHITECTURE_TAG "")
-# {CMAKE_CXX_COMPILER_ARCHITECTURE_ID} is not currently set for all compilers
-if(NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" AND NOT Boost_VERSION VERSION_LESS 106600)
- string(APPEND _boost_ARCHITECTURE_TAG "-")
- # This needs to be kept in-sync with the section of CMakePlatformId.h.in
- # inside 'defined(_WIN32) && defined(_MSC_VER)'
- if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "IA64")
- string(APPEND _boost_ARCHITECTURE_TAG "i")
- elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "X86"
- OR CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "x64")
- string(APPEND _boost_ARCHITECTURE_TAG "x")
- elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "^ARM")
- string(APPEND _boost_ARCHITECTURE_TAG "a")
- elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "MIPS")
- string(APPEND _boost_ARCHITECTURE_TAG "m")
+if(DEFINED Boost_ARCHITECTURE)
+ set(_boost_ARCHITECTURE_TAG "${Boost_ARCHITECTURE}")
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "using user-specified Boost_ARCHITECTURE = ${_boost_ARCHITECTURE_TAG}")
endif()
+else()
+ set(_boost_ARCHITECTURE_TAG "")
+ # {CMAKE_CXX_COMPILER_ARCHITECTURE_ID} is not currently set for all compilers
+ if(NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" AND NOT Boost_VERSION VERSION_LESS 106600)
+ string(APPEND _boost_ARCHITECTURE_TAG "-")
+ # This needs to be kept in-sync with the section of CMakePlatformId.h.in
+ # inside 'defined(_WIN32) && defined(_MSC_VER)'
+ if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "IA64")
+ string(APPEND _boost_ARCHITECTURE_TAG "i")
+ elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "X86"
+ OR CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "x64")
+ string(APPEND _boost_ARCHITECTURE_TAG "x")
+ elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "^ARM")
+ string(APPEND _boost_ARCHITECTURE_TAG "a")
+ elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "MIPS")
+ string(APPEND _boost_ARCHITECTURE_TAG "m")
+ endif()
- if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- string(APPEND _boost_ARCHITECTURE_TAG "64")
- else()
- string(APPEND _boost_ARCHITECTURE_TAG "32")
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ string(APPEND _boost_ARCHITECTURE_TAG "64")
+ else()
+ string(APPEND _boost_ARCHITECTURE_TAG "32")
+ endif()
endif()
endif()
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 7ca9950..2c6145a 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -287,7 +287,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
set(LAPACK_SEARCH_LIBS "")
if (BLA_F95)
- set(LAPACK_mkl_SEARCH_SYMBOL "CHEEV")
+ set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95")
set(_LIBRARIES LAPACK95_LIBRARIES)
set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
@@ -298,7 +298,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
list(APPEND LAPACK_SEARCH_LIBS
"mkl_intel_c")
list(APPEND LAPACK_SEARCH_LIBS
- "mkl_intel_${BLAS_mkl_ILP_MODE}")
+ "mkl_lapack95_${BLAS_mkl_ILP_MODE}")
else()
set(LAPACK_mkl_SEARCH_SYMBOL "cheev")
set(_LIBRARIES LAPACK_LIBRARIES)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index bfcd876..b94e69e 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1131,7 +1131,12 @@ macro(_MPI_create_imported_target LANG)
add_library(MPI::MPI_${LANG} INTERFACE IMPORTED)
endif()
- set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}")
+ # When this is consumed for compiling CUDA, use '-Xcompiler' to wrap '-pthread'.
+ string(REPLACE "-pthread" "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler >-pthread"
+ _MPI_${LANG}_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}")
+ set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${_MPI_${LANG}_COMPILE_OPTIONS}")
+ unset(_MPI_${LANG}_COMPILE_OPTIONS)
+
set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}")
set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "")
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index 3f6fa6c..c044ab3 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -27,7 +27,7 @@
# In Windows the default installation of PostgreSQL uses that as part of the path.
# E.g C:\Program Files\PostgreSQL\8.4.
# Currently, the following version numbers are known to this module:
-# "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0"
+# "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0"
#
# To use this variable just do something like this:
# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4")
@@ -71,7 +71,7 @@ set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to wher
set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
- "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
+ "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
# Define additional search paths for root directories.
set( PostgreSQL_ROOT_DIRECTORIES
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index d6d1ec6..eda0361 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -381,21 +381,16 @@ function(_protobuf_find_libraries name filename)
mark_as_advanced(${name}_LIBRARY_DEBUG)
select_library_configurations(${name})
+
+ if(UNIX AND Threads_FOUND)
+ list(APPEND ${name}_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
+ endif()
+
set(${name}_LIBRARY "${${name}_LIBRARY}" PARENT_SCOPE)
set(${name}_LIBRARIES "${${name}_LIBRARIES}" PARENT_SCOPE)
endif()
endfunction()
-# Internal function: find threads library
-function(_protobuf_find_threads)
- set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
- find_package(Threads)
- if(Threads_FOUND)
- list(APPEND Protobuf_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
- set(Protobuf_LIBRARIES "${Protobuf_LIBRARIES}" PARENT_SCOPE)
- endif()
-endfunction()
-
#
# Main.
#
@@ -416,6 +411,11 @@ if(MSVC)
find_path(Protobuf_SRC_ROOT_FOLDER protobuf.pc.in)
endif()
+if(UNIX)
+ # Protobuf headers may depend on threading.
+ find_package(Threads QUIET)
+endif()
+
# The Protobuf library
_protobuf_find_libraries(Protobuf protobuf)
#DOC "The Google Protocol Buffers RELEASE Library"
@@ -430,10 +430,6 @@ if(MSVC)
set(CMAKE_FIND_LIBRARY_PREFIXES "${Protobuf_ORIG_FIND_LIBRARY_PREFIXES}")
endif()
-if(UNIX)
- _protobuf_find_threads()
-endif()
-
# Find the include directory
find_path(Protobuf_INCLUDE_DIR
google/protobuf/service.h
@@ -521,6 +517,10 @@ if(Protobuf_INCLUDE_DIR)
set_target_properties(protobuf::libprotobuf PROPERTIES
IMPORTED_LOCATION_DEBUG "${Protobuf_LIBRARY_DEBUG}")
endif()
+ if(UNIX AND TARGET Threads::Threads)
+ set_property(TARGET protobuf::libprotobuf APPEND PROPERTY
+ INTERFACE_LINK_LIBRARIES Threads::Threads)
+ endif()
endif()
endif()
@@ -545,6 +545,10 @@ if(Protobuf_INCLUDE_DIR)
set_target_properties(protobuf::libprotobuf-lite PROPERTIES
IMPORTED_LOCATION_DEBUG "${Protobuf_LITE_LIBRARY_DEBUG}")
endif()
+ if(UNIX AND TARGET Threads::Threads)
+ set_property(TARGET protobuf::libprotobuf-lite APPEND PROPERTY
+ INTERFACE_LINK_LIBRARIES Threads::Threads)
+ endif()
endif()
endif()
@@ -569,6 +573,10 @@ if(Protobuf_INCLUDE_DIR)
set_target_properties(protobuf::libprotoc PROPERTIES
IMPORTED_LOCATION_DEBUG "${Protobuf_PROTOC_LIBRARY_DEBUG}")
endif()
+ if(UNIX AND TARGET Threads::Threads)
+ set_property(TARGET protobuf::libprotoc APPEND PROPERTY
+ INTERFACE_LINK_LIBRARIES Threads::Threads)
+ endif()
endif()
endif()
diff --git a/Modules/Internal/CPack/CPackExt.cmake b/Modules/Internal/CPack/CPackExternal.cmake
index e52d978..e4d055a 100644
--- a/Modules/Internal/CPack/CPackExt.cmake
+++ b/Modules/Internal/CPack/CPackExternal.cmake
@@ -1,15 +1,15 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-if(NOT "${CPACK_EXT_REQUESTED_VERSIONS}" STREQUAL "")
+if(NOT "${CPACK_EXTERNAL_REQUESTED_VERSIONS}" STREQUAL "")
unset(_found_major)
- foreach(_req_version IN LISTS CPACK_EXT_REQUESTED_VERSIONS)
+ foreach(_req_version IN LISTS CPACK_EXTERNAL_REQUESTED_VERSIONS)
if(_req_version MATCHES "^([0-9]+)\\.([0-9]+)$")
set(_req_major "${CMAKE_MATCH_1}")
set(_req_minor "${CMAKE_MATCH_2}")
- foreach(_known_version IN LISTS CPACK_EXT_KNOWN_VERSIONS)
+ foreach(_known_version IN LISTS CPACK_EXTERNAL_KNOWN_VERSIONS)
string(REGEX MATCH
"^([0-9]+)\\.([0-9]+)$"
_known_version_dummy
@@ -33,21 +33,21 @@ if(NOT "${CPACK_EXT_REQUESTED_VERSIONS}" STREQUAL "")
endforeach()
if(DEFINED _found_major)
- set(CPACK_EXT_SELECTED_MAJOR "${_found_major}")
- set(CPACK_EXT_SELECTED_MINOR "${_found_minor}")
- set(CPACK_EXT_SELECTED_VERSION "${_found_major}.${_found_minor}")
+ set(CPACK_EXTERNAL_SELECTED_MAJOR "${_found_major}")
+ set(CPACK_EXTERNAL_SELECTED_MINOR "${_found_minor}")
+ set(CPACK_EXTERNAL_SELECTED_VERSION "${_found_major}.${_found_minor}")
else()
message(FATAL_ERROR
- "Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS"
+ "Could not find a suitable version in CPACK_EXTERNAL_REQUESTED_VERSIONS"
)
endif()
else()
- list(GET CPACK_EXT_KNOWN_VERSIONS 0 CPACK_EXT_SELECTED_VERSION)
+ list(GET CPACK_EXTERNAL_KNOWN_VERSIONS 0 CPACK_EXTERNAL_SELECTED_VERSION)
string(REGEX MATCH
"^([0-9]+)\\.([0-9]+)$"
_dummy
- "${CPACK_EXT_SELECTED_VERSION}"
+ "${CPACK_EXTERNAL_SELECTED_VERSION}"
)
- set(CPACK_EXT_SELECTED_MAJOR "${CMAKE_MATCH_1}")
- set(CPACK_EXT_SELECTED_MINOR "${CMAKE_MATCH_2}")
+ set(CPACK_EXTERNAL_SELECTED_MAJOR "${CMAKE_MATCH_1}")
+ set(CPACK_EXTERNAL_SELECTED_MINOR "${CMAKE_MATCH_2}")
endif()
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index f20a53b..82fbc4b 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -122,7 +122,7 @@ ensure generated files will receive the required settings.
If set to ``TRUE``, contents of target property
:prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler.
If set to ``FALSE`` target property :prop_tgt:`INCLUDE_DIRECTORIES` will be
- ignored. If not set, target property ``SWIG_USE_TARGT_INCLUDE_DIRECTORIES``
+ ignored. If not set, target property ``SWIG_USE_TARGET_INCLUDE_DIRECTORIES``
will be considered.
``GENERATED_INCLUDE_DIRECTORIES``, ``GENERATED_COMPILE_DEFINITIONS`` and ``GENERATED_COMPILE_OPTIONS``
@@ -234,6 +234,8 @@ set(SWIG_PYTHON_EXTRA_FILE_EXTENSIONS ".py")
set(SWIG_JAVA_EXTRA_FILE_EXTENSIONS ".java" "JNI.java")
set(SWIG_CSHARP_EXTRA_FILE_EXTENSIONS ".cs" "PINVOKE.cs")
+set(SWIG_MANAGE_SUPPORT_FILES_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/UseSWIG/ManageSupportFiles.cmake")
+
##
## PRIVATE functions
##
@@ -444,9 +446,13 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
if (UseSWIG_MODULE_VERSION VERSION_GREATER 1)
# as part of custom command, start by removing old generated files
# to ensure obsolete files do not stay
- set (swig_cleanup_command COMMAND "${CMAKE_COMMAND}" -E remove_directory "${outdir}")
+ set (swig_file_outdir "${workingdir}/${swig_source_file_name_we}.files")
+ set (swig_cleanup_command COMMAND "${CMAKE_COMMAND}" "-DSUPPORT_FILES_WORKING_DIRECTORY=${swig_file_outdir}" "-DSUPPORT_FILES_OUTPUT_DIRECTORY=${outdir}" -DACTION=CLEAN -P "${SWIG_MANAGE_SUPPORT_FILES_SCRIPT}")
+ set (swig_copy_command COMMAND "${CMAKE_COMMAND}" "-DSUPPORT_FILES_WORKING_DIRECTORY=${swig_file_outdir}" "-DSUPPORT_FILES_OUTPUT_DIRECTORY=${outdir}" -DACTION=COPY -P "${SWIG_MANAGE_SUPPORT_FILES_SCRIPT}")
else()
+ set (swig_file_outdir "${outdir}")
unset (swig_cleanup_command)
+ unset (swig_copy_command)
endif()
# IMPLICIT_DEPENDS below can not handle situations where a dependent file is
@@ -476,16 +482,17 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
COMMAND "${CMAKE_COMMAND}" -E env "SWIG_LIB=${SWIG_DIR}" "${SWIG_EXECUTABLE}"
"-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
"${swig_source_file_flags}"
- -outdir "${outdir}"
+ -outdir "${swig_file_outdir}"
${swig_special_flags}
${swig_extra_flags}
"${swig_include_dirs}"
-o "${swig_generated_file_fullname}"
"${swig_source_file_fullname}"
+ ${swig_copy_command}
MAIN_DEPENDENCY "${swig_source_file_fullname}"
DEPENDS ${swig_dependencies}
IMPLICIT_DEPENDS CXX "${swig_source_file_fullname}"
- COMMENT "Swig source"
+ COMMENT "Swig compile ${infile} for ${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
COMMAND_EXPAND_LISTS)
set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files}
PROPERTIES GENERATED 1)
diff --git a/Modules/UseSWIG/ManageSupportFiles.cmake b/Modules/UseSWIG/ManageSupportFiles.cmake
new file mode 100644
index 0000000..4a03900
--- /dev/null
+++ b/Modules/UseSWIG/ManageSupportFiles.cmake
@@ -0,0 +1,31 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+if (ACTION STREQUAL "CLEAN")
+ # Collect current list of generated files
+ file (GLOB files LIST_DIRECTORIES FALSE RELATIVE "${SUPPORT_FILES_WORKING_DIRECTORY}" "${SUPPORT_FILES_WORKING_DIRECTORY}/*")
+
+ if (files)
+ # clean-up the output directory
+ ## compute full paths
+ list (TRANSFORM files PREPEND "${SUPPORT_FILES_OUTPUT_DIRECTORY}/")
+ ## remove generated files from the output directory
+ file (REMOVE ${files})
+
+ # clean-up working directory
+ file (REMOVE_RECURSE "${SUPPORT_FILES_WORKING_DIRECTORY}")
+ endif()
+
+ file (MAKE_DIRECTORY "${SUPPORT_FILES_WORKING_DIRECTORY}")
+endif()
+
+if (ACTION STREQUAL "COPY")
+ # Collect current list of generated files
+ file (GLOB files LIST_DIRECTORIES FALSE "${SUPPORT_FILES_WORKING_DIRECTORY}/*")
+
+ if (files)
+ # copy files to the output directory
+ file (COPY ${files} DESTINATION "${SUPPORT_FILES_OUTPUT_DIRECTORY}")
+ endif()
+endif()