summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/dev/source.rst18
-rw-r--r--Help/release/dev/ctest_test-ignore-skipped-tests.rst7
-rw-r--r--Help/release/dev/deprecate-policy-old.rst7
-rw-r--r--Help/release/dev/wix-attributes-patch.rst7
-rw-r--r--Help/variable/CMAKE_HOST_WIN32.rst4
-rw-r--r--Modules/FindGLUT.cmake8
-rw-r--r--Modules/FindOpenMP.cmake535
-rw-r--r--Modules/FindXCTest.cmake4
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx10
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx6
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx14
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h2
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXPatch.cxx6
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.cxx26
-rw-r--r--Source/CTest/cmCTestRunTest.cxx8
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx18
-rw-r--r--Source/CursesDialog/cmCursesBoolWidget.h6
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx1
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.h7
-rw-r--r--Source/CursesDialog/cmCursesDummyWidget.h6
-rw-r--r--Source/CursesDialog/cmCursesFilePathWidget.h8
-rw-r--r--Source/CursesDialog/cmCursesForm.cxx2
-rw-r--r--Source/CursesDialog/cmCursesForm.h7
-rw-r--r--Source/CursesDialog/cmCursesLabelWidget.h6
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.h5
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h5
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.h4
-rw-r--r--Source/CursesDialog/cmCursesPathWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesWidget.h7
-rw-r--r--Source/cmCLocaleEnvironmentScope.h7
-rw-r--r--Source/cmCPackPropertiesGenerator.h4
-rw-r--r--Source/cmCommand.h6
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx1
-rw-r--r--Source/cmCommandArgumentParserHelper.h8
-rw-r--r--Source/cmCryptoHash.h7
-rw-r--r--Source/cmDepends.h6
-rw-r--r--Source/cmDependsC.h6
-rw-r--r--Source/cmDependsFortran.h5
-rw-r--r--Source/cmDependsJava.h6
-rw-r--r--Source/cmDocumentation.cxx17
-rw-r--r--Source/cmDynamicLoader.cxx2
-rw-r--r--Source/cmDynamicLoader.h8
-rw-r--r--Source/cmFileLock.h7
-rw-r--r--Source/cmFileLockPool.h12
-rw-r--r--Source/cmGeneratorExpression.h10
-rw-r--r--Source/cmGeneratorExpressionEvaluator.h3
-rw-r--r--Source/cmGeneratorTarget.h5
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio15Generator.cxx2
-rw-r--r--Source/cmInstallGenerator.h2
-rw-r--r--Source/cmLinkLineComputer.h7
-rw-r--r--Source/cmLinkLineDeviceComputer.h4
-rw-r--r--Source/cmLocale.h5
-rw-r--r--Source/cmMSVC60LinkLineComputer.h2
-rw-r--r--Source/cmMakefile.cxx9
-rw-r--r--Source/cmMakefile.h8
-rw-r--r--Source/cmNinjaLinkLineComputer.h2
-rw-r--r--Source/cmNinjaTargetGenerator.cxx19
-rw-r--r--Source/cmPolicies.cxx16
-rw-r--r--Source/cmPolicies.h1
-rw-r--r--Source/cmScriptGenerator.cxx2
-rw-r--r--Source/cmScriptGenerator.h7
-rw-r--r--Source/cmServerProtocol.cxx29
-rw-r--r--Source/cmSystemTools.cxx33
-rw-r--r--Source/cmSystemTools.h13
-rw-r--r--Source/cmTestGenerator.h4
-rw-r--r--Source/cmXMLWriter.h7
-rw-r--r--Source/cmake.h4
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/FindOpenMP/CMakeLists.txt21
-rw-r--r--Tests/FindOpenMP/Test/CMakeLists.txt73
-rw-r--r--Tests/FindOpenMP/Test/main.c7
-rw-r--r--Tests/FindOpenMP/Test/main.f90.in5
-rw-r--r--Tests/FindOpenMP/Test/scalprod.c16
-rw-r--r--Tests/FindOpenMP/Test/scalprod.f90.in19
-rw-r--r--Tests/FindOpenMP/Test/scaltest.c20
-rw-r--r--Tests/FindOpenMP/Test/scaltest.f90.in21
-rw-r--r--Tests/RunCMake/BuildDepends/MakeCustomIncludes.cmake13
-rw-r--r--Tests/RunCMake/BuildDepends/MakeCustomIncludes.cxx6
-rw-r--r--Tests/RunCMake/BuildDepends/MakeCustomIncludes.step1.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/MakeCustomIncludes.step2.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt13
-rw-r--r--Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt10
-rw-r--r--Tests/RunCMake/ctest_disabled_test/DisableCleanupTest-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_disabled_test/DisableFailingTest-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_disabled_test/DisableNotRunTest-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_disabled_test/DisableRequiredTest-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_disabled_test/DisableSetupTest-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_disabled_test/DisabledTest-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_skipped_test/CMakeLists.txt.in12
-rw-r--r--Tests/RunCMake/ctest_skipped_test/CTestConfig.cmake.in1
-rw-r--r--Tests/RunCMake/ctest_skipped_test/RunCMakeTest.cmake51
-rw-r--r--Tests/RunCMake/ctest_skipped_test/SkipCleanupTest-stdout.txt11
-rw-r--r--Tests/RunCMake/ctest_skipped_test/SkipRequiredTest-stdout.txt13
-rw-r--r--Tests/RunCMake/ctest_skipped_test/SkipSetupTest-stdout.txt13
-rw-r--r--Tests/RunCMake/ctest_skipped_test/SkipTest-stdout.txt11
-rwxr-xr-xTests/RunCMake/ctest_skipped_test/skip.bat1
-rwxr-xr-xTests/RunCMake/ctest_skipped_test/skip.sh3
-rw-r--r--Tests/RunCMake/ctest_skipped_test/test.cmake.in16
-rw-r--r--Tests/XCTest/CMakeLists.txt16
-rw-r--r--Tests/XCTest/StaticLibExample/StaticLibExample.c6
-rw-r--r--Tests/XCTest/StaticLibExample/StaticLibExample.h1
-rw-r--r--Tests/XCTest/StaticLibExampleTests/Info.plist24
-rw-r--r--Tests/XCTest/StaticLibExampleTests/StaticLibExampleTests.m16
119 files changed, 1171 insertions, 439 deletions
diff --git a/Help/dev/source.rst b/Help/dev/source.rst
index 3ac9aca..7e44995 100644
--- a/Help/dev/source.rst
+++ b/Help/dev/source.rst
@@ -34,6 +34,24 @@ need to be handled with care:
warnings about deprecated interfaces in general. Use the ``CM_AUTO_PTR``
macro instead.
+* Use ``CM_EQ_DELETE;`` instead of ``= delete;``.
+
+ Defining functions as *deleted* is not supported in C++98. Using
+ ``CM_EQ_DELETE`` will delete the functions if the compiler supports it and
+ give them no implementation otherwise. Calling such a function will lead
+ to compiler errors if the compiler supports *deleted* functions and linker
+ errors otherwise.
+
+* Use ``CM_DISABLE_COPY(Class)`` to mark classes as non-copyable.
+
+ The ``CM_DISABLE_COPY`` macro should be used in the private section of a
+ class to make sure that attempts to copy or assign an instance of the class
+ lead to compiler errors even if the compiler does not support *deleted*
+ functions. As a guideline, all polymorphic classes should be made
+ non-copyable in order to avoid slicing. Classes that are composed of or
+ derived from non-copyable classes must also be made non-copyable explicitly
+ with ``CM_DISABLE_COPY``.
+
* Use ``size_t`` instead of ``std::size_t``.
Various implementations have differing implementation of ``size_t``.
diff --git a/Help/release/dev/ctest_test-ignore-skipped-tests.rst b/Help/release/dev/ctest_test-ignore-skipped-tests.rst
new file mode 100644
index 0000000..1e2486c
--- /dev/null
+++ b/Help/release/dev/ctest_test-ignore-skipped-tests.rst
@@ -0,0 +1,7 @@
+ctest_test-ignore-skipped-tests
+-------------------------------
+
+* When running tests, CTest learned to treat skipped tests (using the
+ :prop_test:`SKIP_RETURN_CODE` property) the same as tests with the
+ :prop_test:`DISABLED` property. Due to this change, CTest will not indicate
+ failure when all tests are either skipped or pass.
diff --git a/Help/release/dev/deprecate-policy-old.rst b/Help/release/dev/deprecate-policy-old.rst
new file mode 100644
index 0000000..9ae30e6
--- /dev/null
+++ b/Help/release/dev/deprecate-policy-old.rst
@@ -0,0 +1,7 @@
+deprecate-policy-old
+--------------------
+
+* An explicit deprecation diagnostic was added for policies ``CMP0036``
+ and below. The :manual:`cmake-policies(7)` manual explains that the
+ OLD behaviors of all policies are deprecated and that projects should
+ port to the NEW behaviors.
diff --git a/Help/release/dev/wix-attributes-patch.rst b/Help/release/dev/wix-attributes-patch.rst
new file mode 100644
index 0000000..e68d9f2
--- /dev/null
+++ b/Help/release/dev/wix-attributes-patch.rst
@@ -0,0 +1,7 @@
+wix-attributes-patch
+--------------------
+
+* The patching system within the :module:`CPackWIX` module now allows the
+ ability to set additional attributes. This can be done by specifying
+ addional attributes with the ``CPackWiXFragment`` XML tag after the
+ ``Id`` attribute. See the :variable:`CPACK_WIX_PATCH_FILE` variable.
diff --git a/Help/variable/CMAKE_HOST_WIN32.rst b/Help/variable/CMAKE_HOST_WIN32.rst
index 0e4c891..876b34c 100644
--- a/Help/variable/CMAKE_HOST_WIN32.rst
+++ b/Help/variable/CMAKE_HOST_WIN32.rst
@@ -1,6 +1,6 @@
CMAKE_HOST_WIN32
----------------
-``True`` on Windows systems, including Win64.
+``True`` if the host system is running Windows, including Windows 64-bit and MSYS.
-Set to ``true`` when the host system is Windows and on Cygwin.
+Set to ``false`` on Cygwin.
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index 02e6df0..88d4b29 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -120,10 +120,12 @@ if (GLUT_FOUND)
# If not, we need some way to figure out what platform we are on.
set( GLUT_LIBRARIES
${GLUT_glut_LIBRARY}
- ${GLUT_Xmu_LIBRARY}
- ${GLUT_Xi_LIBRARY}
- ${GLUT_cocoa_LIBRARY}
)
+ foreach(v GLUT_Xmu_LIBRARY GLUT_Xi_LIBRARY GLUT_cocoa_LIBRARY)
+ if(${v})
+ list(APPEND GLUT_LIBRARIES ${${v}})
+ endif()
+ endforeach()
if(NOT TARGET GLUT::GLUT)
add_library(GLUT::GLUT UNKNOWN IMPORTED)
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index f399836..8c1b018 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -13,112 +13,215 @@
# The variables may be empty if the compiler does not need a special
# flag to support OpenMP.
#
-# The following variables are set:
+# Variables
+# ^^^^^^^^^
#
-# ``OpenMP_C_FLAGS``
-# Flags to add to the C compiler for OpenMP support.
-# ``OpenMP_CXX_FLAGS``
-# Flags to add to the CXX compiler for OpenMP support.
-# ``OpenMP_Fortran_FLAGS``
-# Flags to add to the Fortran compiler for OpenMP support.
-# ``OPENMP_FOUND``
-# True if openmp is detected.
+# This module will set the following variables per language in your
+# project, where ``<lang>`` is one of C, CXX, or Fortran:
#
-# The following internal variables are set, if detected:
+# ``OpenMP_<lang>_FOUND``
+# Variable indicating if OpenMP support for ``<lang>`` was detected.
+# ``OpenMP_<lang>_FLAGS``
+# OpenMP compiler flags for ``<lang>``, separated by spaces.
#
-# ``OpenMP_C_SPEC_DATE``
-# Specification date of OpenMP version of C compiler.
-# ``OpenMP_CXX_SPEC_DATE``
-# Specification date of OpenMP version of CXX compiler.
-# ``OpenMP_Fortran_SPEC_DATE``
-# Specification date of OpenMP version of Fortran compiler.
+# For linking with OpenMP code written in ``<lang>``, the following
+# variables are provided:
#
-# The specification dates are formatted as integers of the form
-# ``CCYYMM`` where these represent the decimal digits of the century,
-# year, and month.
+# ``OpenMP_<lang>_LIB_NAMES``
+# :ref:`;-list <CMake Language Lists>` of libraries for OpenMP programs for ``<lang>``.
+# ``OpenMP_<libname>_LIBRARY``
+# Location of the individual libraries needed for OpenMP support in ``<lang>``.
+# ``OpenMP_<lang>_LIBRARIES``
+# A list of libraries needed to link with OpenMP code written in ``<lang>``.
+#
+# Additionally, the module provides :prop_tgt:`IMPORTED` targets:
+#
+# ``OpenMP::OpenMP_<lang>``
+# Target for using OpenMP from ``<lang>``.
+#
+# Specifically for Fortran, the module sets the following variables:
+#
+# ``OpenMP_Fortran_HAVE_OMPLIB_HEADER``
+# Boolean indicating if OpenMP is accessible through ``omp_lib.h``.
+# ``OpenMP_Fortran_HAVE_OMPLIB_MODULE``
+# Boolean indicating if OpenMP is accessible through the ``omp_lib`` Fortran module.
+#
+# The module will also try to provide the OpenMP version variables:
+#
+# ``OpenMP_<lang>_SPEC_DATE``
+# Date of the OpenMP specification implemented by the ``<lang>`` compiler.
+# ``OpenMP_<lang>_VERSION_MAJOR``
+# Major version of OpenMP implemented by the ``<lang>`` compiler.
+# ``OpenMP_<lang>_VERSION_MINOR``
+# Minor version of OpenMP implemented by the ``<lang>`` compiler.
+# ``OpenMP_<lang>_VERSION``
+# OpenMP version implemented by the ``<lang>`` compiler.
+#
+# The specification date is formatted as given in the OpenMP standard:
+# ``yyyymm`` where ``yyyy`` and ``mm`` represents the year and month of
+# the OpenMP specification implemented by the ``<lang>`` compiler.
+#
+# Backward Compatibility
+# ^^^^^^^^^^^^^^^^^^^^^^
+#
+# For backward compatibility with older versions of FindOpenMP, these
+# variables are set, but deprecated::
+#
+# OpenMP_FOUND
+#
+# In new projects, please use the ``OpenMP_<lang>_XXX`` equivalents.
-set(_OPENMP_REQUIRED_VARS)
-set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
-set(CMAKE_REQUIRED_QUIET ${OpenMP_FIND_QUIETLY})
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
function(_OPENMP_FLAG_CANDIDATES LANG)
- set(OpenMP_FLAG_CANDIDATES
- #Empty, if compiler automatically accepts openmp
- " "
- #GNU
- "-fopenmp"
- #Clang
- "-fopenmp=libiomp5"
- "-fopenmp=libomp"
- #Microsoft Visual Studio
- "/openmp"
- #Intel windows
- "-Qopenmp"
- #PathScale, Intel
- "-openmp"
- #Sun
- "-xopenmp"
- #HP
- "+Oopenmp"
- #IBM XL C/c++
- "-qsmp"
- #Portland Group, MIPSpro
- "-mp"
- )
+ if(NOT OpenMP_${LANG}_FLAG)
+ set(OpenMP_FLAG_CANDIDATES "")
+
+ set(OMP_FLAG_GNU "-fopenmp")
+ set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5")
+ set(OMP_FLAG_HP "+Oopenmp")
+ if(WIN32)
+ set(OMP_FLAG_Intel "-Qopenmp")
+ elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "Intel" AND
+ "${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528")
+ set(OMP_FLAG_Intel "-openmp")
+ else()
+ set(OMP_FLAG_Intel "-qopenmp")
+ endif()
+ set(OMP_FLAG_MIPSpro "-mp")
+ set(OMP_FLAG_MSVC "-openmp")
+ set(OMP_FLAG_PathScale "-openmp")
+ set(OMP_FLAG_PGI "-mp")
+ set(OMP_FLAG_SunPro "-xopenmp")
+ set(OMP_FLAG_XL "-qsmp=omp")
+ # Cray compiles with OpenMP automatically
+
+ if(DEFINED OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID})
+ list(APPEND OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}")
+ endif()
- set(OMP_FLAG_GNU "-fopenmp")
- set(OMP_FLAG_Clang "-fopenmp=libomp")
- set(OMP_FLAG_HP "+Oopenmp")
- if(WIN32)
- set(OMP_FLAG_Intel "-Qopenmp")
- elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "Intel" AND
- "${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528")
- set(OMP_FLAG_Intel "-openmp")
+ list(APPEND OpenMP_FLAG_CANDIDATES " ")
+ set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_FLAG_CANDIDATES}" PARENT_SCOPE)
else()
- set(OMP_FLAG_Intel "-qopenmp")
- endif()
- set(OMP_FLAG_MIPSpro "-mp")
- set(OMP_FLAG_MSVC "/openmp")
- set(OMP_FLAG_PathScale "-openmp")
- set(OMP_FLAG_PGI "-mp")
- set(OMP_FLAG_SunPro "-xopenmp")
- set(OMP_FLAG_XL "-qsmp")
- set(OMP_FLAG_Cray " ")
-
- # Move the flag that matches the compiler to the head of the list,
- # this is faster and doesn't clutter the output that much. If that
- # flag doesn't work we will still try all.
- if(OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID})
- list(REMOVE_ITEM OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}")
- list(INSERT OpenMP_FLAG_CANDIDATES 0 "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}")
+ set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_${LANG}_FLAG}" PARENT_SCOPE)
endif()
-
- set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_FLAG_CANDIDATES}" PARENT_SCOPE)
endfunction()
# sample openmp source code to test
-set(OpenMP_C_TEST_SOURCE
+set(OpenMP_C_CXX_TEST_SOURCE
"
#include <omp.h>
int main() {
-#ifdef _OPENMP
- return 0;
-#else
+#ifndef _OPENMP
breaks_on_purpose
#endif
}
")
-# same in Fortran
+# in Fortran, an implementation may provide an omp_lib.h header
+# or omp_lib module, or both (OpenMP standard, section 3.1)
+# Furthmore !$ is the Fortran equivalent of #ifdef _OPENMP (OpenMP standard, 2.2.2)
+# Without the conditional compilation, some compilers (e.g. PGI) might compile OpenMP code
+# while not actually enabling OpenMP, building code sequentially
set(OpenMP_Fortran_TEST_SOURCE
"
program test
- use omp_lib
- integer :: n
+ @OpenMP_Fortran_INCLUDE_LINE@
+ !$ integer :: n
n = omp_get_num_threads()
end program test
"
- )
+)
+
+function(_OPENMP_WRITE_SOURCE_FILE LANG SRC_FILE_CONTENT_VAR SRC_FILE_NAME SRC_FILE_FULLPATH)
+ set(WORK_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenMP)
+ if("${LANG}" STREQUAL "C")
+ set(SRC_FILE "${WORK_DIR}/${SRC_FILE_NAME}.c")
+ file(WRITE "${SRC_FILE}" "${OpenMP_C_CXX_${SRC_FILE_CONTENT_VAR}}")
+ elseif("${LANG}" STREQUAL "CXX")
+ set(SRC_FILE "${WORK_DIR}/${SRC_FILE_NAME}.cpp")
+ file(WRITE "${SRC_FILE}" "${OpenMP_C_CXX_${SRC_FILE_CONTENT_VAR}}")
+ elseif("${LANG}" STREQUAL "Fortran")
+ set(SRC_FILE "${WORK_DIR}/${SRC_FILE_NAME}.f90")
+ file(WRITE "${SRC_FILE}_in" "${OpenMP_Fortran_${SRC_FILE_CONTENT_VAR}}")
+ configure_file("${SRC_FILE}_in" "${SRC_FILE}" @ONLY)
+ endif()
+ set(${SRC_FILE_FULLPATH} "${SRC_FILE}" PARENT_SCOPE)
+endfunction()
+
+include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
+
+function(_OPENMP_GET_FLAGS LANG OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
+ _OPENMP_FLAG_CANDIDATES("${LANG}")
+ _OPENMP_WRITE_SOURCE_FILE("${LANG}" "TEST_SOURCE" OpenMPTryFlag _OPENMP_TEST_SRC)
+
+ foreach(OPENMP_FLAG IN LISTS OpenMP_${LANG}_FLAG_CANDIDATES)
+ set(OPENMP_FLAGS_TEST "${OPENMP_FLAG}")
+ if(CMAKE_${LANG}_VERBOSE_FLAG)
+ string(APPEND OPENMP_FLAGS_TEST " ${CMAKE_${LANG}_VERBOSE_FLAG}")
+ endif()
+ try_compile( OpenMP_TRY_COMPILE_RESULT ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC}
+ CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}"
+ OUTPUT_VARIABLE OpenMP_TRY_COMPILE_OUTPUT
+ )
+
+ if(OpenMP_TRY_COMPILE_RESULT)
+ unset(OpenMP_TRY_COMPILE_RESULT CACHE)
+ set("${OPENMP_FLAG_VAR}" "${OPENMP_FLAG}" PARENT_SCOPE)
+
+ if(CMAKE_${LANG}_VERBOSE_FLAG)
+ unset(OpenMP_${LANG}_IMPLICIT_LIBRARIES)
+ unset(OpenMP_${LANG}_IMPLICIT_LINK_DIRS)
+ unset(OpenMP_${LANG}_IMPLICIT_FWK_DIRS)
+ unset(OpenMP_${LANG}_LOG_VAR)
+
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Detecting ${LANG} OpenMP compiler ABI info compiled with the following output:\n${OpenMP_TRY_COMPILE_OUTPUT}\n\n")
+
+ cmake_parse_implicit_link_info("${OpenMP_TRY_COMPILE_OUTPUT}"
+ OpenMP_${LANG}_IMPLICIT_LIBRARIES
+ OpenMP_${LANG}_IMPLICIT_LINK_DIRS
+ OpenMP_${LANG}_IMPLICIT_FWK_DIRS
+ OpenMP_${LANG}_LOG_VAR
+ "${CMAKE_${LANG}_IMPLICIT_OBJECT_REGEX}"
+ )
+
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Parsed ${LANG} OpenMP implicit link information from above output:\n${OpenMP_${LANG}_LOG_VAR}\n\n")
+
+ unset(_OPENMP_LIB_NAMES)
+ foreach(_OPENMP_IMPLICIT_LIB IN LISTS OpenMP_${LANG}_IMPLICIT_LIBRARIES)
+ if(NOT "${_OPENMP_IMPLICIT_LIB}" IN_LIST CMAKE_${LANG}_IMPLICIT_LINK_LIBRARIES)
+ find_library(OpenMP_${_OPENMP_IMPLICIT_LIB}_LIBRARY
+ NAMES "${_OPENMP_IMPLICIT_LIB}"
+ HINTS ${OpenMP_${LANG}_IMPLICIT_LINK_DIRS}
+ )
+ mark_as_advanced(OpenMP_${_OPENMP_IMPLICIT_LIB}_LIBRARY)
+ list(APPEND _OPENMP_LIB_NAMES ${_OPENMP_IMPLICIT_LIB})
+ endif()
+ endforeach()
+ set("${OPENMP_LIB_NAMES_VAR}" "${_OPENMP_LIB_NAMES}" PARENT_SCOPE)
+ else()
+ # The Intel compiler on windows has no verbose mode, so we need to treat it explicitly
+ if("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Intel" AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
+ set("${OPENMP_LIB_NAMES_VAR}" "libiomp5md" PARENT_SCOPE)
+ find_library(OpenMP_libiomp5md_LIBRARY
+ NAMES "libiomp5md"
+ HINTS ${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}
+ )
+ mark_as_advanced(OpenMP_libiomp5md_LIBRARY)
+ else()
+ set("${OPENMP_LIB_NAMES_VAR}" "" PARENT_SCOPE)
+ endif()
+ endif()
+ break()
+ endif()
+ set("${OPENMP_LIB_NAMES_VAR}" "NOTFOUND" PARENT_SCOPE)
+ set("${OPENMP_FLAG_VAR}" "NOTFOUND" PARENT_SCOPE)
+ unset(OpenMP_TRY_COMPILE_RESULT CACHE)
+ endforeach()
+endfunction()
set(OpenMP_C_CXX_CHECK_VERSION_SOURCE
"
@@ -133,17 +236,16 @@ const char ompver_str[] = { 'I', 'N', 'F', 'O', ':', 'O', 'p', 'e', 'n', 'M',
('0' + ((_OPENMP/10)%10)),
('0' + ((_OPENMP/1)%10)),
']', '\\0' };
-int main(int argc, char *argv[])
+int main()
{
- printf(\"%s\\n\", ompver_str);
- return 0;
+ puts(ompver_str);
}
")
set(OpenMP_Fortran_CHECK_VERSION_SOURCE
"
program omp_ver
- use omp_lib
+ @OpenMP_Fortran_INCLUDE_LINE@
integer, parameter :: zero = ichar('0')
integer, parameter :: ompv = openmp_version
character, dimension(24), parameter :: ompver_str =&
@@ -160,20 +262,10 @@ set(OpenMP_Fortran_CHECK_VERSION_SOURCE
")
function(_OPENMP_GET_SPEC_DATE LANG SPEC_DATE)
- set(WORK_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenMP)
- if("${LANG}" STREQUAL "C")
- set(SRC_FILE ${WORK_DIR}/ompver.c)
- file(WRITE ${SRC_FILE} "${OpenMP_C_CXX_CHECK_VERSION_SOURCE}")
- elseif("${LANG}" STREQUAL "CXX")
- set(SRC_FILE ${WORK_DIR}/ompver.cpp)
- file(WRITE ${SRC_FILE} "${OpenMP_C_CXX_CHECK_VERSION_SOURCE}")
- else() # ("${LANG}" STREQUAL "Fortran")
- set(SRC_FILE ${WORK_DIR}/ompver.f90)
- file(WRITE ${SRC_FILE} "${OpenMP_Fortran_CHECK_VERSION_SOURCE}")
- endif()
+ _OPENMP_WRITE_SOURCE_FILE("${LANG}" "CHECK_VERSION_SOURCE" OpenMPCheckVersion _OPENMP_TEST_SRC)
- set(BIN_FILE ${WORK_DIR}/ompver_${LANG}.bin)
- try_compile(OpenMP_TRY_COMPILE_RESULT ${CMAKE_BINARY_DIR} ${SRC_FILE}
+ set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenMP/ompver_${LANG}.bin")
+ try_compile(OpenMP_TRY_COMPILE_RESULT "${CMAKE_BINARY_DIR}" "${_OPENMP_TEST_SRC}"
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OpenMP_${LANG}_FLAGS}"
COPY_FILE ${BIN_FILE})
@@ -188,144 +280,173 @@ function(_OPENMP_GET_SPEC_DATE LANG SPEC_DATE)
unset(OpenMP_TRY_COMPILE_RESULT CACHE)
endfunction()
+macro(_OPENMP_SET_VERSION_BY_SPEC_DATE LANG)
+ set(OpenMP_SPEC_DATE_MAP
+ # Combined versions, 2.5 onwards
+ "201511=4.5"
+ "201307=4.0"
+ "201107=3.1"
+ "200805=3.0"
+ "200505=2.5"
+ # C/C++ version 2.0
+ "200203=2.0"
+ # Fortran version 2.0
+ "200011=2.0"
+ # Fortran version 1.1
+ "199911=1.1"
+ # C/C++ version 1.0 (there's no 1.1 for C/C++)
+ "199810=1.0"
+ # Fortran version 1.0
+ "199710=1.0"
+ )
-# check c compiler
-if(CMAKE_C_COMPILER_LOADED)
- # if these are set then do not try to find them again,
- # by avoiding any try_compiles for the flags
- if(OpenMP_C_FLAGS)
- unset(OpenMP_C_FLAG_CANDIDATES)
+ string(REGEX MATCHALL "${OpenMP_${LANG}_SPEC_DATE}=([0-9]+)\\.([0-9]+)" _version_match "${OpenMP_SPEC_DATE_MAP}")
+ if(NOT _version_match STREQUAL "")
+ set(OpenMP_${LANG}_VERSION_MAJOR ${CMAKE_MATCH_1})
+ set(OpenMP_${LANG}_VERSION_MINOR ${CMAKE_MATCH_2})
+ set(OpenMP_${LANG}_VERSION "${OpenMP_${LANG}_VERSION_MAJOR}.${OpenMP_${LANG}_VERSION_MINOR}")
else()
- _OPENMP_FLAG_CANDIDATES("C")
- include(${CMAKE_CURRENT_LIST_DIR}/CheckCSourceCompiles.cmake)
+ unset(OpenMP_${LANG}_VERSION_MAJOR)
+ unset(OpenMP_${LANG}_VERSION_MINOR)
+ unset(OpenMP_${LANG}_VERSION)
endif()
-
- foreach(FLAG IN LISTS OpenMP_C_FLAG_CANDIDATES)
- set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- set(CMAKE_REQUIRED_FLAGS "${FLAG}")
- unset(OpenMP_FLAG_DETECTED CACHE)
- if(NOT CMAKE_REQUIRED_QUIET)
- message(STATUS "Try OpenMP C flag = [${FLAG}]")
- endif()
- check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
- set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
- if(OpenMP_FLAG_DETECTED)
- set(OpenMP_C_FLAGS_INTERNAL "${FLAG}")
- break()
+ unset(_version_match)
+ unset(OpenMP_SPEC_DATE_MAP)
+endmacro()
+
+foreach(LANG IN ITEMS C CXX)
+ if(CMAKE_${LANG}_COMPILER_LOADED)
+ if(NOT DEFINED OpenMP_${LANG}_FLAGS OR "${OpenMP_${LANG}_FLAGS}" STREQUAL "NOTFOUND"
+ OR NOT DEFINED OpenMP_${LANG}_LIB_NAMES OR "${OpenMP_${LANG}_LIB_NAMES}" STREQUAL "NOTFOUND")
+ _OPENMP_GET_FLAGS("${LANG}" OpenMP_${LANG}_FLAGS_WORK OpenMP_${LANG}_LIB_NAMES_WORK)
endif()
- endforeach()
-
- set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}"
- CACHE STRING "C compiler flags for OpenMP parallization")
- list(APPEND _OPENMP_REQUIRED_VARS OpenMP_C_FLAGS)
- unset(OpenMP_C_FLAG_CANDIDATES)
-
- if (NOT OpenMP_C_SPEC_DATE)
- _OPENMP_GET_SPEC_DATE("C" OpenMP_C_SPEC_DATE_INTERNAL)
- set(OpenMP_C_SPEC_DATE "${OpenMP_C_SPEC_DATE_INTERNAL}" CACHE
- INTERNAL "C compiler's OpenMP specification date")
+ set(OpenMP_${LANG}_FLAGS "${OpenMP_${LANG}_FLAGS_WORK}"
+ CACHE STRING "${LANG} compiler flags for OpenMP parallelization")
+ set(OpenMP_${LANG}_LIB_NAMES "${OpenMP_${LANG}_LIB_NAMES_WORK}"
+ CACHE STRING "${LANG} compiler libraries for OpenMP parallelization")
+ mark_as_advanced(OpenMP_${LANG}_FLAGS OpenMP_${LANG}_LIB_NAMES)
endif()
-endif()
+endforeach()
-# check cxx compiler
-if(CMAKE_CXX_COMPILER_LOADED)
- # if these are set then do not try to find them again,
- # by avoiding any try_compiles for the flags
- if(OpenMP_CXX_FLAGS)
- unset(OpenMP_CXX_FLAG_CANDIDATES)
- else()
- _OPENMP_FLAG_CANDIDATES("CXX")
- include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSourceCompiles.cmake)
+if(CMAKE_Fortran_COMPILER_LOADED)
+ if(NOT DEFINED OpenMP_Fortran_FLAGS OR "${OpenMP_Fortran_FLAGS}" STREQUAL "NOTFOUND"
+ OR NOT DEFINED OpenMP_Fortran_LIB_NAMES OR "${OpenMP_Fortran_LIB_NAMES}" STREQUAL "NOTFOUND"
+ OR NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_MODULE)
+ set(OpenMP_Fortran_INCLUDE_LINE "use omp_lib\n implicit none")
+ _OPENMP_GET_FLAGS("Fortran" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK)
+ if(OpenMP_Fortran_FLAGS_WORK)
+ set(OpenMP_Fortran_HAVE_OMPLIB_MODULE TRUE CACHE BOOL INTERNAL "")
+ endif()
- # use the same source for CXX as C for now
- set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE})
+ set(OpenMP_Fortran_FLAGS "${OpenMP_Fortran_FLAGS_WORK}"
+ CACHE STRING "Fortran compiler flags for OpenMP parallelization")
+ set(OpenMP_Fortran_LIB_NAMES "${OpenMP_Fortran_LIB_NAMES_WORK}"
+ CACHE STRING "Fortran compiler libraries for OpenMP parallelization")
+ mark_as_advanced(OpenMP_Fortran_FLAGS OpenMP_Fortran_LIB_NAMES)
endif()
- foreach(FLAG IN LISTS OpenMP_CXX_FLAG_CANDIDATES)
- set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- set(CMAKE_REQUIRED_FLAGS "${FLAG}")
- unset(OpenMP_FLAG_DETECTED CACHE)
- if(NOT CMAKE_REQUIRED_QUIET)
- message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
- endif()
- check_cxx_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
- set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
- if(OpenMP_FLAG_DETECTED)
- set(OpenMP_CXX_FLAGS_INTERNAL "${FLAG}")
- break()
+ if(NOT DEFINED OpenMP_Fortran_FLAGS OR "${OpenMP_Fortran_FLAGS}" STREQUAL "NOTFOUND"
+ OR NOT DEFINED OpenMP_Fortran_LIB_NAMES OR "${OpenMP_Fortran_LIB_NAMES}" STREQUAL "NOTFOUND"
+ OR NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_HEADER)
+ set(OpenMP_Fortran_INCLUDE_LINE "implicit none\n include 'omp_lib.h'")
+ _OPENMP_GET_FLAGS("Fortran" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK)
+ if(OpenMP_Fortran_FLAGS_WORK)
+ set(OpenMP_Fortran_HAVE_OMPLIB_HEADER TRUE CACHE BOOL INTERNAL "")
endif()
- endforeach()
- set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}"
- CACHE STRING "C++ compiler flags for OpenMP parallization")
+ set(OpenMP_Fortran_FLAGS "${OpenMP_Fortran_FLAGS_WORK}"
+ CACHE STRING "Fortran compiler flags for OpenMP parallelization")
- list(APPEND _OPENMP_REQUIRED_VARS OpenMP_CXX_FLAGS)
- unset(OpenMP_CXX_FLAG_CANDIDATES)
-
- if (NOT OpenMP_CXX_SPEC_DATE)
- _OPENMP_GET_SPEC_DATE("CXX" OpenMP_CXX_SPEC_DATE_INTERNAL)
- set(OpenMP_CXX_SPEC_DATE "${OpenMP_CXX_SPEC_DATE_INTERNAL}" CACHE
- INTERNAL "C++ compiler's OpenMP specification date")
+ set(OpenMP_Fortran_LIB_NAMES "${OpenMP_Fortran_LIB_NAMES}"
+ CACHE STRING "Fortran compiler libraries for OpenMP parallelization")
endif()
-endif()
-# check Fortran compiler
-if(CMAKE_Fortran_COMPILER_LOADED)
- # if these are set then do not try to find them again,
- # by avoiding any try_compiles for the flags
- if(OpenMP_Fortran_FLAGS)
- unset(OpenMP_Fortran_FLAG_CANDIDATES)
+ if(OpenMP_Fortran_HAVE_OMPLIB_MODULE)
+ set(OpenMP_Fortran_INCLUDE_LINE "use omp_lib\n implicit none")
else()
- _OPENMP_FLAG_CANDIDATES("Fortran")
- include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranSourceCompiles.cmake)
+ set(OpenMP_Fortran_INCLUDE_LINE "implicit none\n include 'omp_lib.h'")
endif()
+endif()
- foreach(FLAG IN LISTS OpenMP_Fortran_FLAG_CANDIDATES)
- set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- set(CMAKE_REQUIRED_FLAGS "${FLAG}")
- unset(OpenMP_FLAG_DETECTED CACHE)
- if(NOT CMAKE_REQUIRED_QUIET)
- message(STATUS "Try OpenMP Fortran flag = [${FLAG}]")
- endif()
- check_fortran_source_compiles("${OpenMP_Fortran_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
- set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
- if(OpenMP_FLAG_DETECTED)
- set(OpenMP_Fortran_FLAGS_INTERNAL "${FLAG}")
- break()
- endif()
- endforeach()
+set(OPENMP_FOUND TRUE)
- set(OpenMP_Fortran_FLAGS "${OpenMP_Fortran_FLAGS_INTERNAL}"
- CACHE STRING "Fortran compiler flags for OpenMP parallization")
+foreach(LANG IN ITEMS C CXX Fortran)
+ if(CMAKE_${LANG}_COMPILER_LOADED)
+ if (NOT OpenMP_${LANG}_SPEC_DATE)
+ _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")
+ _OPENMP_SET_VERSION_BY_SPEC_DATE("${LANG}")
+ endif()
- list(APPEND _OPENMP_REQUIRED_VARS OpenMP_Fortran_FLAGS)
- unset(OpenMP_Fortran_FLAG_CANDIDATES)
+ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
- if (NOT OpenMP_Fortran_SPEC_DATE)
- _OPENMP_GET_SPEC_DATE("Fortran" OpenMP_Fortran_SPEC_DATE_INTERNAL)
- set(OpenMP_Fortran_SPEC_DATE "${OpenMP_Fortran_SPEC_DATE_INTERNAL}" CACHE
- INTERNAL "Fortran compiler's OpenMP specification date")
- endif()
-endif()
+ set(OpenMP_${LANG}_FIND_QUIETLY ${OpenMP_FIND_QUIETLY})
+ set(OpenMP_${LANG}_FIND_REQUIRED ${OpenMP_FIND_REQUIRED})
+ set(OpenMP_${LANG}_FIND_VERSION ${OpenMP_FIND_VERSION})
+ set(OpenMP_${LANG}_FIND_VERSION_EXACT ${OpenMP_FIND_VERSION_EXACT})
-set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
-
-if(_OPENMP_REQUIRED_VARS)
- include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+ set(_OPENMP_${LANG}_REQUIRED_VARS OpenMP_${LANG}_FLAGS)
+ if("${OpenMP_${LANG}_LIB_NAMES}" STREQUAL "NOTFOUND")
+ set(_OPENMP_${LANG}_REQUIRED_LIB_VARS OpenMP_${LANG}_LIB_NAMES)
+ else()
+ foreach(_OPENMP_IMPLICIT_LIB IN LISTS OpenMP_${LANG}_LIB_NAMES)
+ list(APPEND _OPENMP_${LANG}_REQUIRED_LIB_VARS OpenMP_${_OPENMP_IMPLICIT_LIB}_LIBRARY)
+ endforeach()
+ endif()
- find_package_handle_standard_args(OpenMP
- REQUIRED_VARS ${_OPENMP_REQUIRED_VARS})
+ find_package_handle_standard_args(OpenMP_${LANG}
+ REQUIRED_VARS OpenMP_${LANG}_FLAGS ${_OPENMP_${LANG}_REQUIRED_LIB_VARS}
+ VERSION_VAR OpenMP_${LANG}_VERSION
+ )
+
+ if(OpenMP_${LANG}_FOUND)
+ set(OpenMP_${LANG}_LIBRARIES "")
+ foreach(_OPENMP_IMPLICIT_LIB IN LISTS OpenMP_${LANG}_LIB_NAMES)
+ list(APPEND OpenMP_${LANG}_LIBRARIES "${OpenMP_${_OPENMP_IMPLICIT_LIB}_LIBRARY}")
+ endforeach()
+
+ if(NOT TARGET OpenMP::OpenMP_${LANG})
+ add_library(OpenMP::OpenMP_${LANG} INTERFACE IMPORTED)
+ endif()
+ if(OpenMP_${LANG}_FLAGS)
+ if(CMAKE_HOST_WIN32)
+ separate_arguments(_OpenMP_${LANG}_OPTIONS WINDOWS_COMMAND "${OpenMP_${LANG}_FLAGS}")
+ else()
+ separate_arguments(_OpenMP_${LANG}_OPTIONS UNIX_COMMAND "${OpenMP_${LANG}_FLAGS}")
+ endif()
+ set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY
+ INTERFACE_COMPILE_OPTIONS "${_OpenMP_${LANG}_OPTIONS}")
+ unset(_OpenMP_${LANG}_OPTIONS)
+ endif()
+ if(OpenMP_${LANG}_LIBRARIES)
+ set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY
+ INTERFACE_LINK_LIBRARIES "${OpenMP_${LANG}_LIBRARIES}")
+ endif()
+ else()
+ set(OPENMP_FOUND FALSE)
+ endif()
+ endif()
+endforeach()
- mark_as_advanced(${_OPENMP_REQUIRED_VARS})
+if(CMAKE_Fortran_COMPILER_LOADED AND OpenMP_Fortran_FOUND)
+ if(NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_MODULE)
+ set(OpenMP_Fortran_HAVE_OMPLIB_MODULE FALSE CACHE BOOL INTERNAL "")
+ endif()
+ if(NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_HEADER)
+ set(OpenMP_Fortran_HAVE_OMPLIB_HEADER FALSE CACHE BOOL INTERNAL "")
+ endif()
+endif()
- unset(_OPENMP_REQUIRED_VARS)
-else()
- message(SEND_ERROR "FindOpenMP requires C or CXX language to be enabled")
+if(NOT ( CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED ))
+ message(SEND_ERROR "FindOpenMP requires the C, CXX or Fortran languages to be enabled")
endif()
-unset(OpenMP_C_TEST_SOURCE)
-unset(OpenMP_CXX_TEST_SOURCE)
+unset(OpenMP_C_CXX_TEST_SOURCE)
unset(OpenMP_Fortran_TEST_SOURCE)
unset(OpenMP_C_CXX_CHECK_VERSION_SOURCE)
unset(OpenMP_Fortran_CHECK_VERSION_SOURCE)
+unset(OpenMP_Fortran_INCLUDE_LINE)
+
+cmake_policy(POP)
diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake
index a97bb1b..ffdf677 100644
--- a/Modules/FindXCTest.cmake
+++ b/Modules/FindXCTest.cmake
@@ -123,6 +123,10 @@ function(xctest_add_bundle target testee)
# testee is a Framework
target_link_libraries(${target} PRIVATE ${testee})
+ elseif(_testee_type STREQUAL "STATIC_LIBRARY")
+ # testee is a static library
+ target_link_libraries(${target} PRIVATE ${testee})
+
elseif(_testee_type STREQUAL "EXECUTABLE" AND _testee_macosx_bundle)
# testee is an App Bundle
add_dependencies(${target} ${testee})
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index fcb0b8b..a7b2e63 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 8)
-set(CMake_VERSION_PATCH 20170424)
+set(CMake_VERSION_PATCH 20170427)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 57b47f1..5e5f066 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -171,17 +171,17 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
// WizardStyle
if (const char* option = GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) {
- if (WizardStyle.compare("Modern") == 0 &&
- WizardStyle.compare("Aero") == 0 && WizardStyle.compare("Mac") == 0 &&
- WizardStyle.compare("Classic") == 0) {
+ // Setting the user value in any case
+ WizardStyle = option;
+ // Check known values
+ if (WizardStyle != "Modern" && WizardStyle != "Aero" &&
+ WizardStyle != "Mac" && WizardStyle != "Classic") {
cmCPackLogger(
cmCPackLog::LOG_WARNING,
"Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \""
<< option << "\". Expected values are: Modern, Aero, Mac, Classic."
<< std::endl);
}
-
- WizardStyle = option;
}
// WizardDefaultWidth
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index 99e8b9e..eda383f 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -514,11 +514,11 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
Default.clear();
} else if (const char* value = GetOption(option)) {
std::string lowerValue = cmsys::SystemTools::LowerCase(value);
- if (lowerValue.compare("true") == 0) {
+ if (lowerValue == "true") {
Default = "true";
- } else if (lowerValue.compare("false") == 0) {
+ } else if (lowerValue == "false") {
Default = "false";
- } else if (lowerValue.compare("script") == 0) {
+ } else if (lowerValue == "script") {
Default = "script";
} else {
Default = value;
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 2df23fd..274dfd0 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -677,10 +677,10 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
cpackPackageDesktopLinksList);
}
- AddDirectoryAndFileDefinitons(rootPath, "INSTALL_ROOT", directoryDefinitions,
- fileDefinitions, featureDefinitions,
- cpackPackageExecutablesList,
- cpackPackageDesktopLinksList, shortcuts);
+ AddDirectoryAndFileDefinitions(
+ rootPath, "INSTALL_ROOT", directoryDefinitions, fileDefinitions,
+ featureDefinitions, cpackPackageExecutablesList,
+ cpackPackageDesktopLinksList, shortcuts);
featureDefinitions.EndElement("FeatureRef");
@@ -841,7 +841,7 @@ bool cmCPackWIXGenerator::CreateLicenseFile()
return true;
}
-void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
+void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions(
std::string const& topdir, std::string const& directoryId,
cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXFilesSourceWriter& fileDefinitions,
@@ -906,12 +906,12 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
directoryDefinitions.BeginElement("Directory");
directoryDefinitions.AddAttribute("Id", subDirectoryId);
directoryDefinitions.AddAttribute("Name", fileName);
+ this->Patch->ApplyFragment(subDirectoryId, directoryDefinitions);
- AddDirectoryAndFileDefinitons(
+ AddDirectoryAndFileDefinitions(
fullPath, subDirectoryId, directoryDefinitions, fileDefinitions,
featureDefinitions, packageExecutables, desktopExecutables, shortcuts);
- this->Patch->ApplyFragment(subDirectoryId, directoryDefinitions);
directoryDefinitions.EndElement("Directory");
} else {
cmInstalledFile const* installedFile = this->GetInstalledFile(
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index 353d6c0..b2633a7 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -104,7 +104,7 @@ private:
bool RunLightCommand(std::string const& objectFiles);
- void AddDirectoryAndFileDefinitons(
+ void AddDirectoryAndFileDefinitions(
std::string const& topdir, std::string const& directoryId,
cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXFilesSourceWriter& fileDefinitions,
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
index 79a9fdd..0be4377 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
@@ -44,6 +44,8 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup(
AddAttributeUnlessEmpty("Title", group.DisplayName);
AddAttributeUnlessEmpty("Description", group.Description);
+ patch.ApplyFragment("CM_G_" + group.Name, *this);
+
for (std::vector<cmCPackComponentGroup*>::const_iterator i =
group.Subgroups.begin();
i != group.Subgroups.end(); ++i) {
@@ -56,8 +58,6 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup(
EmitFeatureForComponent(**i, patch);
}
- patch.ApplyFragment("CM_G_" + group.Name, *this);
-
EndElement("Feature");
}
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
index 7aa1212..b4cd1a3 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
@@ -136,6 +136,7 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
}
}
+ patch.ApplyFragment(componentId, *this);
BeginElement("File");
AddAttribute("Id", fileId);
AddAttribute("Source", filePath);
@@ -147,16 +148,15 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
if (!(fileMode & S_IWRITE)) {
AddAttribute("ReadOnly", "yes");
}
+ patch.ApplyFragment(fileId, *this);
if (installedFile) {
cmWIXAccessControlList acl(Logger, *installedFile, *this);
acl.Apply();
}
- patch.ApplyFragment(fileId, *this);
EndElement("File");
- patch.ApplyFragment(componentId, *this);
EndElement("Component");
EndElement("DirectoryRef");
diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx
index 3a7dbfd..287a644 100644
--- a/Source/CPack/WiX/cmWIXPatch.cxx
+++ b/Source/CPack/WiX/cmWIXPatch.cxx
@@ -29,7 +29,11 @@ void cmWIXPatch::ApplyFragment(std::string const& id,
return;
const cmWIXPatchElement& fragment = i->second;
-
+ for (cmWIXPatchElement::attributes_t::const_iterator attr_i =
+ fragment.attributes.begin();
+ attr_i != fragment.attributes.end(); ++attr_i) {
+ writer.AddAttribute(attr_i->first, attr_i->second);
+ }
this->ApplyElementChildren(fragment, writer);
Fragments.erase(i);
diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx
index 7f2ae19..0dcc74a 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.cxx
+++ b/Source/CPack/WiX/cmWIXPatchParser.cxx
@@ -72,9 +72,11 @@ void cmWIXPatchParser::StartElement(const std::string& name, const char** atts)
void cmWIXPatchParser::StartFragment(const char** attributes)
{
+ cmWIXPatchElement* new_element = CM_NULLPTR;
+ /* find the id of for fragment */
for (size_t i = 0; attributes[i]; i += 2) {
- std::string key = attributes[i];
- std::string value = attributes[i + 1];
+ const std::string key = attributes[i];
+ const std::string value = attributes[i + 1];
if (key == "Id") {
if (Fragments.find(value) != Fragments.end()) {
@@ -83,10 +85,22 @@ void cmWIXPatchParser::StartFragment(const char** attributes)
ReportValidationError(tmp.str());
}
- ElementStack.push_back(&Fragments[value]);
- } else {
- ReportValidationError(
- "The only allowed 'CPackWixFragment' attribute is 'Id'");
+ new_element = &Fragments[value];
+ ElementStack.push_back(new_element);
+ }
+ }
+
+ /* add any additional attributes for the fragement */
+ if (!new_element) {
+ ReportValidationError("No 'Id' specified for 'CPackWixFragment' element");
+ } else {
+ for (size_t i = 0; attributes[i]; i += 2) {
+ const std::string key = attributes[i];
+ const std::string value = attributes[i + 1];
+
+ if (key != "Id") {
+ new_element->attributes[key] = value;
+ }
}
}
}
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index a4853b7..fe23075 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -167,6 +167,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
std::vector<std::pair<cmsys::RegularExpression, std::string> >::iterator
passIt;
bool forceFail = false;
+ bool skipped = false;
bool outputTestErrorsToConsole = false;
if (!this->TestProperties->RequiredRegularExpressions.empty() &&
this->FailedDependencies.empty()) {
@@ -219,6 +220,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
s << "SKIP_RETURN_CODE=" << this->TestProperties->SkipReturnCode;
this->TestResult.CompletionStatus = s.str();
cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Skipped ");
+ skipped = true;
} else if ((success && !this->TestProperties->WillFail) ||
(!success && this->TestProperties->WillFail)) {
this->TestResult.Status = cmCTestTestHandler::COMPLETED;
@@ -338,7 +340,9 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
compress ? this->CompressedOutput : this->ProcessOutput;
this->TestResult.CompressOutput = compress;
this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
- this->TestResult.CompletionStatus = "Completed";
+ if (!skipped) {
+ this->TestResult.CompletionStatus = "Completed";
+ }
this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
this->MemCheckPostProcess();
this->ComputeWeightedCost();
@@ -349,7 +353,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
this->TestHandler->TestResults.push_back(this->TestResult);
}
delete this->TestProcess;
- return passed;
+ return passed || skipped;
}
bool cmCTestRunTest::StartAgain()
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 167fecf..d73811b 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -17,6 +17,7 @@
#include <string.h>
#include <time.h>
+#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestBatchTestHandler.h"
#include "cmCTestMultiProcessHandler.h"
@@ -495,7 +496,8 @@ int cmCTestTestHandler::ProcessHandler()
for (SetOfTests::iterator ftit = resultsSet.begin();
ftit != resultsSet.end(); ++ftit) {
- if (ftit->CompletionStatus == "Disabled") {
+ if (cmHasLiteralPrefix(ftit->CompletionStatus, "SKIP_RETURN_CODE=") ||
+ ftit->CompletionStatus == "Disabled") {
disabledTests.push_back(*ftit);
}
}
@@ -521,17 +523,22 @@ int cmCTestTestHandler::ProcessHandler()
if (!disabledTests.empty()) {
cmGeneratedFileStream ofs;
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
- << "The following tests are disabled and did not run:"
- << std::endl);
+ << "The following tests did not run:" << std::endl);
this->StartLogFile("TestsDisabled", ofs);
+ const char* disabled_reason;
for (std::vector<cmCTestTestHandler::cmCTestTestResult>::iterator dtit =
disabledTests.begin();
dtit != disabledTests.end(); ++dtit) {
ofs << dtit->TestCount << ":" << dtit->Name << std::endl;
+ if (dtit->CompletionStatus == "Disabled") {
+ disabled_reason = "Disabled";
+ } else {
+ disabled_reason = "Skipped";
+ }
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t"
<< std::setw(3) << dtit->TestCount << " - " << dtit->Name
- << std::endl);
+ << " (" << disabled_reason << ")" << std::endl);
}
}
@@ -544,6 +551,7 @@ int cmCTestTestHandler::ProcessHandler()
for (SetOfTests::iterator ftit = resultsSet.begin();
ftit != resultsSet.end(); ++ftit) {
if (ftit->Status != cmCTestTestHandler::COMPLETED &&
+ !cmHasLiteralPrefix(ftit->CompletionStatus, "SKIP_RETURN_CODE=") &&
ftit->CompletionStatus != "Disabled") {
ofs << ftit->TestCount << ":" << ftit->Name << std::endl;
cmCTestLog(
@@ -1727,7 +1735,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
// bcc crashes if we attempt a normal substring comparison,
// hence the following workaround
std::string fileNameSubstring = fileName.substr(0, pattern.length());
- if (fileNameSubstring.compare(pattern) != 0) {
+ if (fileNameSubstring != pattern) {
continue;
}
if (logName == "") {
diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h
index 45f01aa..90bcc22 100644
--- a/Source/CursesDialog/cmCursesBoolWidget.h
+++ b/Source/CursesDialog/cmCursesBoolWidget.h
@@ -12,6 +12,8 @@ class cmCursesMainForm;
class cmCursesBoolWidget : public cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesBoolWidget)
+
public:
cmCursesBoolWidget(int width, int height, int left, int top);
@@ -25,10 +27,6 @@ public:
// Set/Get the value (on/off).
void SetValueAsBool(bool value);
bool GetValueAsBool();
-
-protected:
- cmCursesBoolWidget(const cmCursesBoolWidget& from);
- void operator=(const cmCursesBoolWidget&);
};
#endif // cmCursesBoolWidget_h
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index cdde1a3..d071c91 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -14,7 +14,6 @@
#include "cmSystemTools.h"
#include "cmake.h"
-#include "cmConfigure.h"
#include <assert.h>
#include <vector>
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h
index 1dbcfa4..3c50078 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.h
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h
@@ -3,7 +3,7 @@
#ifndef cmCursesCacheEntryComposite_h
#define cmCursesCacheEntryComposite_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <string>
@@ -13,6 +13,8 @@ class cmake;
class cmCursesCacheEntryComposite
{
+ CM_DISABLE_COPY(cmCursesCacheEntryComposite)
+
public:
cmCursesCacheEntryComposite(const std::string& key, int labelwidth,
int entrywidth);
@@ -24,9 +26,6 @@ public:
friend class cmCursesMainForm;
protected:
- cmCursesCacheEntryComposite(const cmCursesCacheEntryComposite& from);
- void operator=(const cmCursesCacheEntryComposite&);
-
cmCursesLabelWidget* Label;
cmCursesLabelWidget* IsNewLabel;
cmCursesWidget* Entry;
diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h
index 0381f25..d9bb6ba 100644
--- a/Source/CursesDialog/cmCursesDummyWidget.h
+++ b/Source/CursesDialog/cmCursesDummyWidget.h
@@ -12,6 +12,8 @@ class cmCursesMainForm;
class cmCursesDummyWidget : public cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesDummyWidget)
+
public:
cmCursesDummyWidget(int width, int height, int left, int top);
@@ -20,10 +22,6 @@ public:
// when this widget has focus. Returns true if the input was
// handled.
bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
-
-protected:
- cmCursesDummyWidget(const cmCursesDummyWidget& from);
- void operator=(const cmCursesDummyWidget&);
};
#endif // cmCursesDummyWidget_h
diff --git a/Source/CursesDialog/cmCursesFilePathWidget.h b/Source/CursesDialog/cmCursesFilePathWidget.h
index b4c04cb..6ad535b 100644
--- a/Source/CursesDialog/cmCursesFilePathWidget.h
+++ b/Source/CursesDialog/cmCursesFilePathWidget.h
@@ -3,18 +3,16 @@
#ifndef cmCursesFilePathWidget_h
#define cmCursesFilePathWidget_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmCursesPathWidget.h"
class cmCursesFilePathWidget : public cmCursesPathWidget
{
+ CM_DISABLE_COPY(cmCursesFilePathWidget)
+
public:
cmCursesFilePathWidget(int width, int height, int left, int top);
-
-protected:
- cmCursesFilePathWidget(const cmCursesFilePathWidget& from);
- void operator=(const cmCursesFilePathWidget&);
};
#endif // cmCursesFilePathWidget_h
diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx
index 12e5d75..06c1e9c 100644
--- a/Source/CursesDialog/cmCursesForm.cxx
+++ b/Source/CursesDialog/cmCursesForm.cxx
@@ -2,8 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCursesForm.h"
-#include "cmConfigure.h"
-
cmsys::ofstream cmCursesForm::DebugFile;
bool cmCursesForm::Debug = false;
diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h
index 7eb94a8..553105c 100644
--- a/Source/CursesDialog/cmCursesForm.h
+++ b/Source/CursesDialog/cmCursesForm.h
@@ -3,7 +3,7 @@
#ifndef cmCursesForm_h
#define cmCursesForm_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmCursesStandardIncludes.h"
@@ -11,6 +11,8 @@
class cmCursesForm
{
+ CM_DISABLE_COPY(cmCursesForm)
+
public:
cmCursesForm();
virtual ~cmCursesForm();
@@ -55,9 +57,6 @@ protected:
static cmsys::ofstream DebugFile;
static bool Debug;
- cmCursesForm(const cmCursesForm& form);
- void operator=(const cmCursesForm&);
-
FORM* Form;
};
diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h
index a0de4c6..267de7c 100644
--- a/Source/CursesDialog/cmCursesLabelWidget.h
+++ b/Source/CursesDialog/cmCursesLabelWidget.h
@@ -14,6 +14,8 @@ class cmCursesMainForm;
class cmCursesLabelWidget : public cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesLabelWidget)
+
public:
cmCursesLabelWidget(int width, int height, int left, int top,
const std::string& name);
@@ -24,10 +26,6 @@ public:
// when this widget has focus. Returns true if the input was
// handled
bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
-
-protected:
- cmCursesLabelWidget(const cmCursesLabelWidget& from);
- void operator=(const cmCursesLabelWidget&);
};
#endif // cmCursesLabelWidget_h
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h
index ab49c07..cd8e095 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.h
+++ b/Source/CursesDialog/cmCursesLongMessageForm.h
@@ -13,6 +13,8 @@
class cmCursesLongMessageForm : public cmCursesForm
{
+ CM_DISABLE_COPY(cmCursesLongMessageForm)
+
public:
cmCursesLongMessageForm(std::vector<std::string> const& messages,
const char* title);
@@ -38,9 +40,6 @@ public:
void UpdateStatusBar() CM_OVERRIDE;
protected:
- cmCursesLongMessageForm(const cmCursesLongMessageForm& from);
- void operator=(const cmCursesLongMessageForm&);
-
std::string Messages;
std::string Title;
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index b91211e..e35cf3e 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -23,6 +23,8 @@ class cmake;
*/
class cmCursesMainForm : public cmCursesForm
{
+ CM_DISABLE_COPY(cmCursesMainForm)
+
public:
cmCursesMainForm(std::vector<std::string> const& args, int initwidth);
~cmCursesMainForm() CM_OVERRIDE;
@@ -103,9 +105,6 @@ public:
static void UpdateProgress(const char* msg, float prog, void*);
protected:
- cmCursesMainForm(const cmCursesMainForm& from);
- void operator=(const cmCursesMainForm&);
-
// Copy the cache values from the user interface to the actual
// cache.
void FillCacheManagerFromUI();
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h
index 4b2e8b4..7f4416f 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.h
+++ b/Source/CursesDialog/cmCursesOptionsWidget.h
@@ -15,6 +15,8 @@ class cmCursesMainForm;
class cmCursesOptionsWidget : public cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesOptionsWidget)
+
public:
cmCursesOptionsWidget(int width, int height, int left, int top);
@@ -29,8 +31,6 @@ public:
void PreviousOption();
protected:
- cmCursesOptionsWidget(const cmCursesOptionsWidget& from);
- void operator=(const cmCursesOptionsWidget&);
std::vector<std::string> Options;
std::vector<std::string>::size_type CurrentOption;
};
diff --git a/Source/CursesDialog/cmCursesPathWidget.h b/Source/CursesDialog/cmCursesPathWidget.h
index 097eeca..ae6c16d 100644
--- a/Source/CursesDialog/cmCursesPathWidget.h
+++ b/Source/CursesDialog/cmCursesPathWidget.h
@@ -14,6 +14,8 @@ class cmCursesMainForm;
class cmCursesPathWidget : public cmCursesStringWidget
{
+ CM_DISABLE_COPY(cmCursesPathWidget)
+
public:
cmCursesPathWidget(int width, int height, int left, int top);
@@ -26,9 +28,6 @@ public:
void OnType(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
protected:
- cmCursesPathWidget(const cmCursesPathWidget& from);
- void operator=(const cmCursesPathWidget&);
-
std::string LastString;
std::string LastGlob;
bool Cycle;
diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h
index c07bfce..5eb3366 100644
--- a/Source/CursesDialog/cmCursesStringWidget.h
+++ b/Source/CursesDialog/cmCursesStringWidget.h
@@ -20,6 +20,8 @@ class cmCursesMainForm;
class cmCursesStringWidget : public cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesStringWidget)
+
public:
cmCursesStringWidget(int width, int height, int left, int top);
@@ -60,9 +62,6 @@ public:
bool PrintKeys() CM_OVERRIDE;
protected:
- cmCursesStringWidget(const cmCursesStringWidget& from);
- void operator=(const cmCursesStringWidget&);
-
// true if the widget is in edit mode
bool InEdit;
char* OriginalString;
diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx
index 229a050..054f27e 100644
--- a/Source/CursesDialog/cmCursesWidget.cxx
+++ b/Source/CursesDialog/cmCursesWidget.cxx
@@ -2,8 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCursesWidget.h"
-#include "cmConfigure.h"
-
cmCursesWidget::cmCursesWidget(int width, int height, int left, int top)
{
this->Field = new_field(height, width, top, left, 0, 0);
diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h
index 5ce8a75..3470d70 100644
--- a/Source/CursesDialog/cmCursesWidget.h
+++ b/Source/CursesDialog/cmCursesWidget.h
@@ -3,7 +3,7 @@
#ifndef cmCursesWidget_h
#define cmCursesWidget_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmCursesStandardIncludes.h"
#include "cmStateTypes.h"
@@ -14,6 +14,8 @@ class cmCursesMainForm;
class cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesWidget)
+
public:
cmCursesWidget(int width, int height, int left, int top);
virtual ~cmCursesWidget();
@@ -59,9 +61,6 @@ public:
friend class cmCursesMainForm;
protected:
- cmCursesWidget(const cmCursesWidget& from);
- void operator=(const cmCursesWidget&);
-
cmStateEnums::CacheEntryType Type;
std::string Value;
FIELD* Field;
diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h
index 1e7c42a..e956cb2 100644
--- a/Source/cmCLocaleEnvironmentScope.h
+++ b/Source/cmCLocaleEnvironmentScope.h
@@ -3,21 +3,20 @@
#ifndef cmCLocaleEnvironmentScope_h
#define cmCLocaleEnvironmentScope_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <map>
#include <string>
class cmCLocaleEnvironmentScope
{
+ CM_DISABLE_COPY(cmCLocaleEnvironmentScope)
+
public:
cmCLocaleEnvironmentScope();
~cmCLocaleEnvironmentScope();
private:
- cmCLocaleEnvironmentScope(cmCLocaleEnvironmentScope const&);
- cmCLocaleEnvironmentScope& operator=(cmCLocaleEnvironmentScope const&);
-
std::string GetEnv(std::string const& key);
void SetEnv(std::string const& key, std::string const& value);
diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h
index 107ccf9..48f4c10 100644
--- a/Source/cmCPackPropertiesGenerator.h
+++ b/Source/cmCPackPropertiesGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackPropertiesGenerator_h
#define cmCPackPropertiesGenerator_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmScriptGenerator.h"
@@ -20,6 +20,8 @@ class cmLocalGenerator;
*/
class cmCPackPropertiesGenerator : public cmScriptGenerator
{
+ CM_DISABLE_COPY(cmCPackPropertiesGenerator)
+
public:
cmCPackPropertiesGenerator(cmLocalGenerator* lg,
cmInstalledFile const& installedFile,
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index f4a75d5..62eced0 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -24,6 +24,8 @@ struct cmListFileArgument;
*/
class cmCommand
{
+ CM_DISABLE_COPY(cmCommand)
+
public:
/**
* Construct the command. By default it has no makefile.
@@ -103,10 +105,6 @@ public:
*/
void SetError(const std::string& e);
-private:
- cmCommand(cmCommand const&); // = delete;
- cmCommand& operator=(cmCommand const&); // = delete;
-
protected:
cmMakefile* Makefile;
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 153efc4..4eb4531 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -8,7 +8,6 @@
#include "cmSystemTools.h"
#include "cmake.h"
-#include "cmConfigure.h"
#include <iostream>
#include <sstream>
#include <string.h>
diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h
index c0c1cd9..465ca9e 100644
--- a/Source/cmCommandArgumentParserHelper.h
+++ b/Source/cmCommandArgumentParserHelper.h
@@ -3,7 +3,7 @@
#ifndef cmCommandArgumentParserHelper_h
#define cmCommandArgumentParserHelper_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <string>
#include <vector>
@@ -12,6 +12,8 @@ class cmMakefile;
class cmCommandArgumentParserHelper
{
+ CM_DISABLE_COPY(cmCommandArgumentParserHelper)
+
public:
struct ParserType
{
@@ -60,10 +62,6 @@ public:
char BSLASHVariable[3];
private:
- cmCommandArgumentParserHelper(cmCommandArgumentParserHelper const&);
- cmCommandArgumentParserHelper& operator=(
- cmCommandArgumentParserHelper const&);
-
std::string::size_type InputBufferPos;
std::string InputBuffer;
std::vector<char> OutputBuffer;
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index ac92c48..c380d85 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -3,7 +3,7 @@
#ifndef cmCryptoHash_h
#define cmCryptoHash_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <stddef.h>
#include <string>
@@ -16,6 +16,8 @@
*/
class cmCryptoHash
{
+ CM_DISABLE_COPY(cmCryptoHash)
+
public:
enum Algo
{
@@ -78,9 +80,6 @@ public:
std::string FinalizeHex();
private:
- cmCryptoHash(cmCryptoHash const&);
- cmCryptoHash& operator=(cmCryptoHash const&);
-
unsigned int Id;
struct rhash_context* CTX;
};
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index a80b585..b33feb9 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -24,6 +24,8 @@ class cmLocalGenerator;
*/
class cmDepends
{
+ CM_DISABLE_COPY(cmDepends)
+
public:
/** Instances need to know the build directory name and the relative
path from the build directory to the target file. */
@@ -116,10 +118,6 @@ protected:
std::vector<std::string> IncludePath;
void SetIncludePathFromLanguage(const std::string& lang);
-
-private:
- cmDepends(cmDepends const&); // Purposely not implemented.
- void operator=(cmDepends const&); // Purposely not implemented.
};
#endif
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index 4f52826..250d40f 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -22,6 +22,8 @@ class cmLocalGenerator;
*/
class cmDependsC : public cmDepends
{
+ CM_DISABLE_COPY(cmDependsC)
+
public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
@@ -93,10 +95,6 @@ protected:
void WriteCacheFile() const;
void ReadCacheFile();
-
-private:
- cmDependsC(cmDependsC const&); // Purposely not implemented.
- void operator=(cmDependsC const&); // Purposely not implemented.
};
#endif
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index a9a1ed3..ec208af 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -21,6 +21,8 @@ class cmLocalGenerator;
*/
class cmDependsFortran : public cmDepends
{
+ CM_DISABLE_COPY(cmDependsFortran)
+
public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
@@ -77,9 +79,6 @@ protected:
cmDependsFortranInternals* Internal;
private:
- cmDependsFortran(cmDependsFortran const&); // Purposely not implemented.
- void operator=(cmDependsFortran const&); // Purposely not implemented.
-
std::string MaybeConvertToRelativePath(std::string const& base,
std::string const& path);
};
diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h
index 6efa51a..a07bf09 100644
--- a/Source/cmDependsJava.h
+++ b/Source/cmDependsJava.h
@@ -17,6 +17,8 @@
*/
class cmDependsJava : public cmDepends
{
+ CM_DISABLE_COPY(cmDependsJava)
+
public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
@@ -33,10 +35,6 @@ protected:
bool CheckDependencies(
std::istream& internalDepends, const char* internalDependsFileName,
std::map<std::string, DependencyVector>& validDeps) CM_OVERRIDE;
-
-private:
- cmDependsJava(cmDependsJava const&); // Purposely not implemented.
- void operator=(cmDependsJava const&); // Purposely not implemented.
};
#endif
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 5f25113..c6286b3 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -129,28 +129,19 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
this->CurrentArgument = i->Argument;
// If a file name was given, use it. Otherwise, default to the
// given stream.
- cmsys::ofstream* fout = CM_NULLPTR;
+ cmsys::ofstream fout;
std::ostream* s = &os;
if (!i->Filename.empty()) {
- fout = new cmsys::ofstream(i->Filename.c_str());
- if (fout) {
- s = fout;
- } else {
- result = false;
- }
+ fout.open(i->Filename.c_str());
+ s = &fout;
} else if (++count > 1) {
os << "\n\n";
}
// Print this documentation type to the stream.
- if (!this->PrintDocumentation(i->HelpType, *s) || !*s) {
+ if (!this->PrintDocumentation(i->HelpType, *s) || s->fail()) {
result = false;
}
-
- // Close the file if we wrote one.
- if (fout) {
- delete fout;
- }
}
return result;
}
diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx
index 76a4a29..f530ba7 100644
--- a/Source/cmDynamicLoader.cxx
+++ b/Source/cmDynamicLoader.cxx
@@ -2,8 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmDynamicLoader.h"
-#include "cmConfigure.h"
-
#include <map>
#include <string>
#include <utility>
diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h
index dd69b40..7c46dd5 100644
--- a/Source/cmDynamicLoader.h
+++ b/Source/cmDynamicLoader.h
@@ -8,12 +8,14 @@
#ifndef cmDynamicLoader_h
#define cmDynamicLoader_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmsys/DynamicLoader.hxx" // IWYU pragma: export
class cmDynamicLoader
{
+ CM_DISABLE_COPY(cmDynamicLoader)
+
public:
// Description:
// Load a dynamic library into the current process.
@@ -28,10 +30,6 @@ public:
protected:
cmDynamicLoader() {}
~cmDynamicLoader() {}
-
-private:
- cmDynamicLoader(const cmDynamicLoader&); // Not implemented.
- void operator=(const cmDynamicLoader&); // Not implemented.
};
#endif
diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h
index 8f996cf..ccef508 100644
--- a/Source/cmFileLock.h
+++ b/Source/cmFileLock.h
@@ -3,7 +3,7 @@
#ifndef cmFileLock_h
#define cmFileLock_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <string>
@@ -21,6 +21,8 @@ class cmFileLockResult;
*/
class cmFileLock
{
+ CM_DISABLE_COPY(cmFileLock)
+
public:
cmFileLock();
~cmFileLock();
@@ -44,9 +46,6 @@ public:
bool IsLocked(const std::string& filename) const;
private:
- cmFileLock(const cmFileLock&);
- cmFileLock& operator=(const cmFileLock&);
-
cmFileLockResult OpenFile();
cmFileLockResult LockWithoutTimeout();
cmFileLockResult LockWithTimeout(unsigned long timeoutSec);
diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h
index 09c984c..689ddd7 100644
--- a/Source/cmFileLockPool.h
+++ b/Source/cmFileLockPool.h
@@ -3,7 +3,7 @@
#ifndef cmFileLockPool_h
#define cmFileLockPool_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <list>
#include <string>
@@ -13,6 +13,8 @@ class cmFileLockResult;
class cmFileLockPool
{
+ CM_DISABLE_COPY(cmFileLockPool)
+
public:
cmFileLockPool();
~cmFileLockPool();
@@ -52,13 +54,12 @@ public:
cmFileLockResult Release(const std::string& filename);
private:
- cmFileLockPool(const cmFileLockPool&);
- cmFileLockPool& operator=(const cmFileLockPool&);
-
bool IsAlreadyLocked(const std::string& filename) const;
class ScopePool
{
+ CM_DISABLE_COPY(ScopePool)
+
public:
ScopePool();
~ScopePool();
@@ -69,9 +70,6 @@ private:
bool IsAlreadyLocked(const std::string& filename) const;
private:
- ScopePool(const ScopePool&);
- ScopePool& operator=(const ScopePool&);
-
typedef std::list<cmFileLock*> List;
typedef List::iterator It;
typedef List::const_iterator CIt;
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 694ce8a..34516f5 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -31,6 +31,8 @@ struct cmGeneratorExpressionEvaluator;
*/
class cmGeneratorExpression
{
+ CM_DISABLE_COPY(cmGeneratorExpression)
+
public:
/** Construct. */
cmGeneratorExpression(
@@ -61,14 +63,13 @@ public:
static std::string StripEmptyListElements(const std::string& input);
private:
- cmGeneratorExpression(const cmGeneratorExpression&);
- void operator=(const cmGeneratorExpression&);
-
cmListFileBacktrace Backtrace;
};
class cmCompiledGeneratorExpression
{
+ CM_DISABLE_COPY(cmCompiledGeneratorExpression)
+
public:
const char* Evaluate(
cmLocalGenerator* lg, const std::string& config, bool quiet = false,
@@ -133,9 +134,6 @@ private:
friend class cmGeneratorExpression;
- cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression&);
- void operator=(const cmCompiledGeneratorExpression&);
-
cmListFileBacktrace Backtrace;
std::vector<cmGeneratorExpressionEvaluator*> Evaluators;
const std::string Input;
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index a6a341b..a0a826a 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -30,8 +30,7 @@ struct cmGeneratorExpressionEvaluator
cmGeneratorExpressionDAGChecker*) const = 0;
private:
- cmGeneratorExpressionEvaluator(const cmGeneratorExpressionEvaluator&);
- void operator=(const cmGeneratorExpressionEvaluator&);
+ CM_DISABLE_COPY(cmGeneratorExpressionEvaluator)
};
struct TextContent : public cmGeneratorExpressionEvaluator
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index ae12f97..13b6b73 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -27,6 +27,8 @@ class cmTarget;
class cmGeneratorTarget
{
+ CM_DISABLE_COPY(cmGeneratorTarget)
+
public:
cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg);
~cmGeneratorTarget();
@@ -701,9 +703,6 @@ private:
void CheckPropertyCompatibility(cmComputeLinkInformation* info,
const std::string& config) const;
- cmGeneratorTarget(cmGeneratorTarget const&);
- void operator=(cmGeneratorTarget const&);
-
struct LinkImplClosure : public std::vector<cmGeneratorTarget const*>
{
LinkImplClosure()
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 1a77d7c..587e18a 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1842,10 +1842,14 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
std::vector<std::string>::const_iterator argEnd)
{
+ std::vector<std::string> arg_full =
+ cmSystemTools::HandleResponseFile(argBeg, argEnd);
+
std::string arg_dd;
std::string arg_tdi;
std::vector<std::string> arg_ddis;
- for (std::vector<std::string>::const_iterator a = argBeg; a != argEnd; ++a) {
+ for (std::vector<std::string>::const_iterator a = arg_full.begin();
+ a != arg_full.end(); ++a) {
std::string const& arg = *a;
if (cmHasLiteralPrefix(arg, "--tdi=")) {
arg_tdi = arg.substr(6);
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx
index 2312bc0..da2bf8c 100644
--- a/Source/cmGlobalVisualStudio15Generator.cxx
+++ b/Source/cmGlobalVisualStudio15Generator.cxx
@@ -164,7 +164,7 @@ bool cmGlobalVisualStudio15Generator::IsWin81SDKInstalled() const
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\"
"Windows Kits\\Installed Roots;KitsRoot81",
win81Root, cmSystemTools::KeyWOW64_32)) {
- return true;
+ return cmSystemTools::FileExists(win81Root + "/um/windows.h", true);
}
return false;
}
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index bb1dd54..de19f98 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -21,6 +21,8 @@ class cmMakefile;
*/
class cmInstallGenerator : public cmScriptGenerator
{
+ CM_DISABLE_COPY(cmInstallGenerator)
+
public:
enum MessageLevel
{
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index d8dacf3..27b8adb 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -4,7 +4,7 @@
#ifndef cmLinkLineComputer_h
#define cmLinkLineComputer_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <string>
@@ -16,6 +16,8 @@ class cmOutputConverter;
class cmLinkLineComputer
{
+ CM_DISABLE_COPY(cmLinkLineComputer)
+
public:
cmLinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir);
@@ -41,9 +43,6 @@ public:
std::string const& config);
protected:
- cmLinkLineComputer(cmLinkLineComputer const&);
- cmLinkLineComputer& operator=(cmLinkLineComputer const&);
-
std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
std::string ComputeRPath(cmComputeLinkInformation& cli);
diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h
index a827b06..e9e98ac 100644
--- a/Source/cmLinkLineDeviceComputer.h
+++ b/Source/cmLinkLineDeviceComputer.h
@@ -18,6 +18,8 @@ class cmStateDirectory;
class cmLinkLineDeviceComputer : public cmLinkLineComputer
{
+ CM_DISABLE_COPY(cmLinkLineDeviceComputer)
+
public:
cmLinkLineDeviceComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir);
@@ -33,6 +35,8 @@ public:
class cmNinjaLinkLineDeviceComputer : public cmLinkLineDeviceComputer
{
+ CM_DISABLE_COPY(cmNinjaLinkLineDeviceComputer)
+
public:
cmNinjaLinkLineDeviceComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir,
diff --git a/Source/cmLocale.h b/Source/cmLocale.h
index 086f448..9f90a3a 100644
--- a/Source/cmLocale.h
+++ b/Source/cmLocale.h
@@ -10,6 +10,8 @@
class cmLocaleRAII
{
+ CM_DISABLE_COPY(cmLocaleRAII)
+
public:
cmLocaleRAII()
: OldLocale(setlocale(LC_CTYPE, CM_NULLPTR))
@@ -19,9 +21,6 @@ public:
~cmLocaleRAII() { setlocale(LC_CTYPE, this->OldLocale.c_str()); }
private:
- cmLocaleRAII(cmLocaleRAII const&);
- cmLocaleRAII& operator=(cmLocaleRAII const&);
-
std::string OldLocale;
};
diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h
index 612658c..e494060 100644
--- a/Source/cmMSVC60LinkLineComputer.h
+++ b/Source/cmMSVC60LinkLineComputer.h
@@ -15,6 +15,8 @@ class cmStateDirectory;
class cmMSVC60LinkLineComputer : public cmLinkLineComputer
{
+ CM_DISABLE_COPY(cmMSVC60LinkLineComputer)
+
public:
cmMSVC60LinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4ed76c7..cb11060 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3153,7 +3153,7 @@ void cmMakefile::EnableLanguage(std::vector<std::string> const& lang,
langs.reserve(lang.size());
for (std::vector<std::string>::const_iterator i = lang.begin();
i != lang.end(); ++i) {
- if (i->compare("RC") == 0) {
+ if (*i == "RC") {
langsRC.push_back(*i);
} else {
langs.push_back(*i);
@@ -4002,6 +4002,13 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
return false;
}
+ // Deprecate old policies, especially those that require a lot
+ // of code to maintain the old behavior.
+ if (status == cmPolicies::OLD && id <= cmPolicies::CMP0036) {
+ this->IssueMessage(cmake::DEPRECATION_WARNING,
+ cmPolicies::GetPolicyDeprecatedWarning(id));
+ }
+
this->StateSnapshot.SetPolicy(id, status);
return true;
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 2f4cea6..52a6498 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -54,6 +54,8 @@ class cmVariableWatch;
*/
class cmMakefile
{
+ CM_DISABLE_COPY(cmMakefile)
+
public:
/* Mark a variable as used */
void MarkVariableAsUsed(const std::string& var);
@@ -709,6 +711,7 @@ public:
/** Helper class to push and pop scopes automatically. */
class ScopePushPop
{
+ CM_DISABLE_COPY(ScopePushPop)
public:
ScopePushPop(cmMakefile* m)
: Makefile(m)
@@ -717,8 +720,6 @@ public:
}
~ScopePushPop() { this->Makefile->PopScope(); }
private:
- ScopePushPop(ScopePushPop const&);
- ScopePushPop& operator=(ScopePushPop const&);
cmMakefile* Makefile;
};
@@ -831,9 +832,6 @@ protected:
cmExecutionStatus& status);
private:
- cmMakefile(const cmMakefile& mf);
- cmMakefile& operator=(const cmMakefile& mf);
-
cmStateSnapshot StateSnapshot;
cmListFileBacktrace Backtrace;
diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h
index db6d4a8..e612e88 100644
--- a/Source/cmNinjaLinkLineComputer.h
+++ b/Source/cmNinjaLinkLineComputer.h
@@ -16,6 +16,8 @@ class cmStateDirectory;
class cmNinjaLinkLineComputer : public cmLinkLineComputer
{
+ CM_DISABLE_COPY(cmNinjaLinkLineComputer)
+
public:
cmNinjaLinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir,
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index e0b2217..7e29681 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -557,13 +557,26 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
// Write the rule for ninja dyndep file generation.
std::vector<std::string> ddCmds;
+#ifdef _WIN32
+ // Windows command line length is limited -> use response file for dyndep
+ // rules
+ std::string ddRspFile = "$out.rsp";
+ std::string ddRspContent = "$in";
+ std::string ddInput = "@" + ddRspFile;
+#else
+ std::string ddRspFile;
+ std::string ddRspContent;
+ std::string ddInput = "$in";
+#endif
+
// Run CMake dependency scanner on preprocessed output.
std::string const cmake = this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
ddCmds.push_back(cmake + " -E cmake_ninja_dyndep"
" --tdi=" +
tdi + " --dd=$out"
- " $in");
+ " " +
+ ddInput);
std::string const ddCmdLine =
this->GetLocalGenerator()->BuildCommandLine(ddCmds);
@@ -575,9 +588,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
this->GetGlobalGenerator()->AddRule(
this->LanguageDyndepRule(lang), ddCmdLine, ddDesc.str(), ddComment.str(),
/*depfile*/ "",
- /*deps*/ "",
- /*rspfile*/ "",
- /*rspcontent*/ "",
+ /*deps*/ "", ddRspFile, ddRspContent,
/*restat*/ "",
/*generator*/ false);
}
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 837557b..da3edd4 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -275,6 +275,22 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
return msg.str();
}
+std::string cmPolicies::GetPolicyDeprecatedWarning(cmPolicies::PolicyID id)
+{
+ std::ostringstream msg;
+ /* clang-format off */
+ msg <<
+ "The OLD behavior for policy " << idToString(id) << " "
+ "will be removed from a future version of CMake.\n"
+ "The cmake-policies(7) manual explains that the OLD behaviors of all "
+ "policies are deprecated and that a policy should be set to OLD only "
+ "under specific short-term circumstances. Projects should be ported "
+ "to the NEW behavior and not rely on setting a policy to OLD."
+ ;
+ /* clang-format on */
+ return msg.str();
+}
+
///! return an error string for when a required policy is unspecified
std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
{
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 120beb6..69cbc18 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -279,6 +279,7 @@ public:
///! return a warning string for a given policy
static std::string GetPolicyWarning(cmPolicies::PolicyID id);
+ static std::string GetPolicyDeprecatedWarning(cmPolicies::PolicyID id);
///! return an error string for when a required policy is unspecified
static std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index 3cf2537..753a1ba 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -4,8 +4,6 @@
#include "cmSystemTools.h"
-#include "cmConfigure.h"
-
cmScriptGenerator::cmScriptGenerator(
const std::string& config_var,
std::vector<std::string> const& configurations)
diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h
index 4023f3e..d0879c6 100644
--- a/Source/cmScriptGenerator.h
+++ b/Source/cmScriptGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmScriptGenerator_h
#define cmScriptGenerator_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <ostream>
#include <string>
@@ -47,6 +47,8 @@ inline std::ostream& operator<<(std::ostream& os,
*/
class cmScriptGenerator
{
+ CM_DISABLE_COPY(cmScriptGenerator)
+
public:
cmScriptGenerator(const std::string& config_var,
std::vector<std::string> const& configurations);
@@ -87,9 +89,6 @@ protected:
bool ActionsPerConfig;
private:
- cmScriptGenerator(cmScriptGenerator const&);
- cmScriptGenerator& operator=(cmScriptGenerator const&);
-
void GenerateScriptActionsOnce(std::ostream& os, Indent indent);
void GenerateScriptActionsPerConfig(std::ostream& os, Indent indent);
};
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 8227ab7..11ee897 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -50,9 +50,8 @@ std::vector<std::string> getConfigurations(const cmake* cm)
bool hasString(const Json::Value& v, const std::string& s)
{
return !v.isNull() &&
- std::find_if(v.begin(), v.end(), [s](const Json::Value& i) {
- return i.asString() == s;
- }) != v.end();
+ std::any_of(v.begin(), v.end(),
+ [s](const Json::Value& i) { return i.asString() == s; });
}
template <class T>
@@ -493,16 +492,14 @@ cmServerResponse cmServerProtocol1_0::ProcessCache(
if (keys.empty()) {
keys = allKeys;
} else {
- for (auto i : keys) {
- if (std::find_if(allKeys.begin(), allKeys.end(),
- [i](const std::string& j) { return i == j; }) ==
- allKeys.end()) {
+ for (const auto& i : keys) {
+ if (std::find(allKeys.begin(), allKeys.end(), i) == allKeys.end()) {
return request.ReportError("Key \"" + i + "\" not found in cache.");
}
}
}
std::sort(keys.begin(), keys.end());
- for (auto key : keys) {
+ for (const auto& key : keys) {
Json::Value entry = Json::objectValue;
entry[kKEY_KEY] = key;
entry[kTYPE_KEY] =
@@ -511,7 +508,7 @@ cmServerResponse cmServerProtocol1_0::ProcessCache(
Json::Value props = Json::objectValue;
bool haveProperties = false;
- for (auto prop : state->GetCacheEntryPropertyList(key)) {
+ for (const auto& prop : state->GetCacheEntryPropertyList(key)) {
haveProperties = true;
props[prop] = state->GetCacheEntryProperty(key, prop);
}
@@ -598,7 +595,7 @@ bool LanguageData::operator==(const LanguageData& other) const
void LanguageData::SetDefines(const std::set<std::string>& defines)
{
std::vector<std::string> result;
- for (auto i : defines) {
+ for (const auto& i : defines) {
result.push_back(i);
}
std::sort(result.begin(), result.end());
@@ -615,11 +612,11 @@ struct hash<LanguageData>
using std::hash;
size_t result =
hash<std::string>()(in.Language) ^ hash<std::string>()(in.Flags);
- for (auto i : in.IncludePathList) {
+ for (const auto& i : in.IncludePathList) {
result = result ^ (hash<std::string>()(i.first) ^
(i.second ? std::numeric_limits<size_t>::max() : 0));
}
- for (auto i : in.Defines) {
+ for (const auto& i : in.Defines) {
result = result ^ hash<std::string>()(i);
}
result =
@@ -643,7 +640,7 @@ static Json::Value DumpSourceFileGroup(const LanguageData& data,
}
if (!data.IncludePathList.empty()) {
Json::Value includes = Json::arrayValue;
- for (auto i : data.IncludePathList) {
+ for (const auto& i : data.IncludePathList) {
Json::Value tmp = Json::objectValue;
tmp[kPATH_KEY] = i.first;
if (i.second) {
@@ -661,7 +658,7 @@ static Json::Value DumpSourceFileGroup(const LanguageData& data,
result[kIS_GENERATED_KEY] = data.IsGenerated;
Json::Value sourcesValue = Json::arrayValue;
- for (auto i : files) {
+ for (const auto& i : files) {
const std::string relPath =
cmSystemTools::RelativePath(baseDir.c_str(), i.c_str());
sourcesValue.append(relPath.size() < i.size() ? relPath : i);
@@ -819,7 +816,7 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
std::set<std::string> languages;
target->GetLanguages(languages, config);
std::map<std::string, LanguageData> languageDataMap;
- for (auto lang : languages) {
+ for (const auto& lang : languages) {
LanguageData& ld = languageDataMap[lang];
ld.Language = lang;
lg->GetTargetCompileFlags(target, config, lang, ld.Flags);
@@ -1095,7 +1092,7 @@ cmServerResponse cmServerProtocol1_0::ProcessSetGlobalSettings(
kWARN_UNINITIALIZED_KEY, kWARN_UNUSED_KEY, kWARN_UNUSED_CLI_KEY,
kCHECK_SYSTEM_VARS_KEY
};
- for (auto i : boolValues) {
+ for (const auto& i : boolValues) {
if (!request.Data[i].isNull() && !request.Data[i].isBool()) {
return request.ReportError("\"" + i +
"\" must be unset or a bool value.");
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 6d620d9..8978e18 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -505,6 +505,39 @@ void cmSystemTools::ParseUnixCommandLine(const char* command,
argv.Store(args);
}
+std::vector<std::string> cmSystemTools::HandleResponseFile(
+ std::vector<std::string>::const_iterator argBeg,
+ std::vector<std::string>::const_iterator argEnd)
+{
+ std::vector<std::string> arg_full;
+ for (std::vector<std::string>::const_iterator a = argBeg; a != argEnd; ++a) {
+ std::string const& arg = *a;
+ if (cmHasLiteralPrefix(arg, "@")) {
+ cmsys::ifstream responseFile(arg.substr(1).c_str(), std::ios::in);
+ if (!responseFile) {
+ std::string error = "failed to open for reading (";
+ error += cmSystemTools::GetLastSystemError();
+ error += "):\n ";
+ error += arg.substr(1);
+ cmSystemTools::Error(error.c_str());
+ } else {
+ std::string line;
+ cmSystemTools::GetLineFromStream(responseFile, line);
+ std::vector<std::string> args2;
+#ifdef _WIN32
+ cmSystemTools::ParseWindowsCommandLine(line.c_str(), args2);
+#else
+ cmSystemTools::ParseUnixCommandLine(line.c_str(), args2);
+#endif
+ arg_full.insert(arg_full.end(), args2.begin(), args2.end());
+ }
+ } else {
+ arg_full.push_back(arg);
+ }
+ }
+ return arg_full;
+}
+
std::vector<std::string> cmSystemTools::ParseArguments(const char* command)
{
std::vector<std::string> args;
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 3ba2c22..9de7967 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -3,7 +3,7 @@
#ifndef cmSystemTools_h
#define cmSystemTools_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmProcessOutput.h"
#include "cmsys/Process.h"
@@ -253,6 +253,13 @@ public:
static void ParseUnixCommandLine(const char* command,
std::vector<std::string>& args);
+ /**
+ * Handle response file in an argument list and return a new argument list
+ * **/
+ static std::vector<std::string> HandleResponseFile(
+ std::vector<std::string>::const_iterator argBeg,
+ std::vector<std::string>::const_iterator argEnd);
+
static size_t CalculateCommandLineLengthLimit();
static void EnableMessages() { s_DisableMessages = false; }
@@ -379,14 +386,12 @@ public:
original environment. */
class SaveRestoreEnvironment
{
+ CM_DISABLE_COPY(SaveRestoreEnvironment)
public:
SaveRestoreEnvironment();
~SaveRestoreEnvironment();
private:
- SaveRestoreEnvironment(SaveRestoreEnvironment const&);
- SaveRestoreEnvironment& operator=(SaveRestoreEnvironment const&);
-
std::vector<std::string> Env;
};
#endif
diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h
index 9a25e33..b227305 100644
--- a/Source/cmTestGenerator.h
+++ b/Source/cmTestGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmTestGenerator_h
#define cmTestGenerator_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmScriptGenerator.h"
@@ -20,6 +20,8 @@ class cmTest;
*/
class cmTestGenerator : public cmScriptGenerator
{
+ CM_DISABLE_COPY(cmTestGenerator)
+
public:
cmTestGenerator(cmTest* test,
std::vector<std::string> const& configurations =
diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h
index 14c82b1..ed76a88 100644
--- a/Source/cmXMLWriter.h
+++ b/Source/cmXMLWriter.h
@@ -3,7 +3,7 @@
#ifndef cmXMLWiter_h
#define cmXMLWiter_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmXMLSafe.h"
@@ -14,6 +14,8 @@
class cmXMLWriter
{
+ CM_DISABLE_COPY(cmXMLWriter)
+
public:
cmXMLWriter(std::ostream& output, std::size_t level = 0);
~cmXMLWriter();
@@ -63,9 +65,6 @@ public:
void SetIndentationElement(std::string const& element);
private:
- cmXMLWriter(const cmXMLWriter&);
- cmXMLWriter& operator=(const cmXMLWriter&);
-
void ConditionalLineBreak(bool condition, std::size_t indent);
void PreAttribute();
diff --git a/Source/cmake.h b/Source/cmake.h
index 6a6beb4..16a2830 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -55,6 +55,8 @@ struct cmDocumentationEntry;
class cmake
{
+ CM_DISABLE_COPY(cmake)
+
public:
enum MessageType
{
@@ -460,8 +462,6 @@ protected:
cmVariableWatch* VariableWatch;
private:
- cmake(const cmake&); // Not implemented.
- void operator=(const cmake&); // Not implemented.
ProgressCallbackType ProgressCallback;
void* ProgressCallbackClientData;
bool InTryCompile;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 60a2cbb..2f53cfc9 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1421,6 +1421,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindOpenGL)
endif()
+ if(CMake_TEST_FindOpenMP)
+ add_subdirectory(FindOpenMP)
+ endif()
+
if(CMake_TEST_FindOpenSSL)
add_subdirectory(FindOpenSSL)
endif()
diff --git a/Tests/FindOpenMP/CMakeLists.txt b/Tests/FindOpenMP/CMakeLists.txt
new file mode 100644
index 0000000..e64885d
--- /dev/null
+++ b/Tests/FindOpenMP/CMakeLists.txt
@@ -0,0 +1,21 @@
+foreach(c C CXX Fortran)
+ if(CMake_TEST_FindOpenMP_${c})
+ set(CMake_TEST_FindOpenMP_FLAG_${c} 1)
+ else()
+ set(CMake_TEST_FindOpenMP_FLAG_${c} 0)
+ endif()
+endforeach()
+
+add_test(NAME FindOpenMP.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindOpenMP/Test"
+ "${CMake_BINARY_DIR}/Tests/FindOpenMP/Test"
+ ${build_generator_args}
+ --build-project TestFindOpenMP
+ --build-options ${build_options}
+ -DOpenMP_TEST_C=${CMake_TEST_FindOpenMP_FLAG_C}
+ -DOpenMP_TEST_CXX=${CMake_TEST_FindOpenMP_FLAG_CXX}
+ -DOpenMP_TEST_Fortran=${CMake_TEST_FindOpenMP_FLAG_Fortran}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindOpenMP/Test/CMakeLists.txt b/Tests/FindOpenMP/Test/CMakeLists.txt
new file mode 100644
index 0000000..4ba0e5c
--- /dev/null
+++ b/Tests/FindOpenMP/Test/CMakeLists.txt
@@ -0,0 +1,73 @@
+cmake_minimum_required(VERSION 3.8)
+project(TestFindOpenMP)
+include(CTest)
+
+macro(source_code_mapper_helper LANG_NAME SRC_FILE_NAME)
+ if("${LANG_NAME}" STREQUAL "C")
+ set(OpenMPTEST_SOURCE_FILE "${SRC_FILE_NAME}.c")
+ elseif("${LANG_NAME}" STREQUAL "CXX")
+ configure_file("${SRC_FILE_NAME}.c" "${SRC_FILE_NAME}.cxx" COPYONLY)
+ set(OpenMPTEST_SOURCE_FILE "${SRC_FILE_NAME}.cxx")
+ elseif("${LANG_NAME}" STREQUAL "Fortran")
+ set(OpenMPTEST_SOURCE_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE_NAME}.f90")
+ if(OpenMP_Fortran_HAVE_OMPLIB_MODULE)
+ set(OpenMP_Fortran_INCLUDE_LINE "use omp_lib\n implicit none")
+ else()
+ set(OpenMP_Fortran_INCLUDE_LINE "implicit none\n include 'omp_lib.h'")
+ endif()
+ configure_file("${SRC_FILE_NAME}.f90.in" "${OpenMPTEST_SOURCE_FILE}" @ONLY)
+ endif()
+endmacro()
+
+foreach(c C CXX Fortran)
+ if("${OpenMP_TEST_${c}}")
+ message("Testing ${c}")
+ enable_language(${c})
+ endif()
+endforeach()
+
+find_package(OpenMP REQUIRED)
+
+foreach(c C CXX Fortran)
+ if(NOT "${OpenMP_TEST_${c}}")
+ continue()
+ endif()
+ source_code_mapper_helper(${c} main)
+ add_executable(test_tgt_${c} ${OpenMPTEST_SOURCE_FILE})
+ target_link_libraries(test_tgt_${c} PRIVATE OpenMP::OpenMP_${c})
+ set_property(TARGET test_tgt_${c} PROPERTY LINKER_LANGUAGE ${c})
+ add_test(NAME test_tgt_${c} COMMAND test_tgt_${c})
+
+ add_executable(test_var_${c} ${OpenMPTEST_SOURCE_FILE})
+ if(CMAKE_HOST_WIN32)
+ separate_arguments(_OpenMP_${c}_OPTIONS WINDOWS_COMMAND "${OpenMP_${c}_FLAGS}")
+ else()
+ separate_arguments(_OpenMP_${c}_OPTIONS UNIX_COMMAND "${OpenMP_${c}_FLAGS}")
+ endif()
+ target_compile_options(test_var_${c} PRIVATE "${_OpenMP_${c}_OPTIONS}")
+ target_link_libraries(test_var_${c} PRIVATE "${OpenMP_${c}_FLAGS}")
+ set_property(TARGET test_var_${c} PROPERTY LINKER_LANGUAGE ${c})
+ add_test(NAME test_var_${c} COMMAND test_var_${c})
+
+ source_code_mapper_helper(${c} scalprod)
+ add_library(scalprod_${c} STATIC ${OpenMPTEST_SOURCE_FILE})
+ target_link_libraries(scalprod_${c} PRIVATE OpenMP::OpenMP_${c})
+ set_property(TARGET scalprod_${c} PROPERTY LINKER_LANGUAGE ${c})
+endforeach()
+
+foreach(c C CXX Fortran)
+ if(NOT "${OpenMP_TEST_${c}}")
+ continue()
+ endif()
+ foreach(d C CXX Fortran)
+ if(NOT "${OpenMP_TEST_${d}}")
+ continue()
+ endif()
+ source_code_mapper_helper(${c} scaltest)
+ add_executable(scaltest_${c}_${d} ${OpenMPTEST_SOURCE_FILE})
+ target_link_libraries(scaltest_${c}_${d} PRIVATE scalprod_${d})
+ set_property(TARGET scaltest_${c}_${d} PROPERTY LINKER_LANGUAGE ${c})
+ add_test(NAME test_omp_${c}_${d} COMMAND scaltest_${c}_${d})
+ set_property(TEST test_omp_${c}_${d} PROPERTY PASS_REGULAR_EXPRESSION "^[ \t]*70\\.?0*")
+ endforeach()
+endforeach()
diff --git a/Tests/FindOpenMP/Test/main.c b/Tests/FindOpenMP/Test/main.c
new file mode 100644
index 0000000..4f0e874
--- /dev/null
+++ b/Tests/FindOpenMP/Test/main.c
@@ -0,0 +1,7 @@
+#include <omp.h>
+int main()
+{
+#ifndef _OPENMP
+ breaks_on_purpose
+#endif
+}
diff --git a/Tests/FindOpenMP/Test/main.f90.in b/Tests/FindOpenMP/Test/main.f90.in
new file mode 100644
index 0000000..9da22a1
--- /dev/null
+++ b/Tests/FindOpenMP/Test/main.f90.in
@@ -0,0 +1,5 @@
+ program test
+ @OpenMP_Fortran_INCLUDE_LINE@
+ !$ integer :: n
+ n = omp_get_num_threads()
+ end program test
diff --git a/Tests/FindOpenMP/Test/scalprod.c b/Tests/FindOpenMP/Test/scalprod.c
new file mode 100644
index 0000000..24c4587
--- /dev/null
+++ b/Tests/FindOpenMP/Test/scalprod.c
@@ -0,0 +1,16 @@
+#include <omp.h>
+
+#ifdef __cplusplus
+extern "C"
+#endif
+ void
+ scalprod(int n, double* x, double* y, double* res)
+{
+ int i;
+ double res_v = 0.;
+#pragma omp parallel for reduction(+ : res_v)
+ for (i = 0; i < n; ++i) {
+ res_v += x[i] * y[i];
+ }
+ *res = res_v;
+}
diff --git a/Tests/FindOpenMP/Test/scalprod.f90.in b/Tests/FindOpenMP/Test/scalprod.f90.in
new file mode 100644
index 0000000..efc7ea0
--- /dev/null
+++ b/Tests/FindOpenMP/Test/scalprod.f90.in
@@ -0,0 +1,19 @@
+subroutine scalprod(n, x_p, y_p, res) bind(c)
+ use iso_c_binding
+ implicit none
+ integer(c_int), intent(in), value :: n
+ type(c_ptr), intent(in), value :: x_p, y_p
+ real(c_double), pointer :: x(:), y(:)
+ integer :: i
+
+ real(c_double) :: res
+ real(c_double) :: scalpt = 0
+ call c_f_pointer(x_p, x, shape=[n])
+ call c_f_pointer(y_p, y, shape=[n])
+ res = 0
+!$omp parallel do private(scalpt), reduction(+:res)
+ do i=1,n
+ scalpt = y(i) * x(i)
+ res = res + scalpt
+ end do
+end subroutine scalprod
diff --git a/Tests/FindOpenMP/Test/scaltest.c b/Tests/FindOpenMP/Test/scaltest.c
new file mode 100644
index 0000000..2ee57f8
--- /dev/null
+++ b/Tests/FindOpenMP/Test/scaltest.c
@@ -0,0 +1,20 @@
+#ifdef __cplusplus
+#include <iostream>
+extern "C"
+#else
+#include <stdio.h>
+#endif
+int scalprod(int n, double* x, double* y, double* res);
+
+int main()
+{
+ double a[5] = { 1., 2., 3., 4., 5. };
+ double b[5] = { 2., 3., 4., 5., 6. };
+ double rk;
+ scalprod(5, a, b, &rk);
+#ifdef __cplusplus
+ std::cout << rk << std::endl;
+#else
+ printf("%f\n", rk);
+#endif
+}
diff --git a/Tests/FindOpenMP/Test/scaltest.f90.in b/Tests/FindOpenMP/Test/scaltest.f90.in
new file mode 100644
index 0000000..64c20d2
--- /dev/null
+++ b/Tests/FindOpenMP/Test/scaltest.f90.in
@@ -0,0 +1,21 @@
+program scaltest
+ use iso_c_binding
+ implicit none
+ interface
+ subroutine scalprod(n, x_p, y_p, res) bind(c)
+ use iso_c_binding
+ integer(c_int), value :: n
+ type(c_ptr), value :: x_p, y_p
+ real(c_double) :: res
+ end subroutine scalprod
+ end interface
+ type(c_ptr) :: x_pt, y_pt
+ real(c_double), dimension(5), target :: a = (/ 1, 2, 3, 4, 5 /)
+ real(c_double), dimension(5), target :: b = (/ 2, 3, 4, 5, 6 /)
+ integer(c_int) :: n = size(a)
+ real(c_double) :: res
+ x_pt = c_loc(a)
+ y_pt = c_loc(b)
+ call scalprod(n, x_pt, y_pt, res)
+ print *, res
+end program scaltest
diff --git a/Tests/RunCMake/BuildDepends/MakeCustomIncludes.cmake b/Tests/RunCMake/BuildDepends/MakeCustomIncludes.cmake
new file mode 100644
index 0000000..0f92e0e
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/MakeCustomIncludes.cmake
@@ -0,0 +1,13 @@
+add_custom_command(
+ OUTPUT output.cxx
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/MakeCustomIncludes.cxx output.cxx
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/MakeCustomIncludes.cxx
+ IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/MakeCustomIncludes.cxx)
+add_custom_target(generate ALL DEPENDS output.cxx)
+set_property(TARGET generate PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR})
+
+file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT "
+set(check_pairs
+ \"${CMAKE_CURRENT_BINARY_DIR}/output.cxx|${CMAKE_CURRENT_BINARY_DIR}/MakeCustomIncludes.h\"
+ )
+")
diff --git a/Tests/RunCMake/BuildDepends/MakeCustomIncludes.cxx b/Tests/RunCMake/BuildDepends/MakeCustomIncludes.cxx
new file mode 100644
index 0000000..9a0edef
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/MakeCustomIncludes.cxx
@@ -0,0 +1,6 @@
+#include "MakeCustomIncludes.h"
+
+int main()
+{
+ return MakeCustomIncludes();
+}
diff --git a/Tests/RunCMake/BuildDepends/MakeCustomIncludes.step1.cmake b/Tests/RunCMake/BuildDepends/MakeCustomIncludes.step1.cmake
new file mode 100644
index 0000000..6bb01a6
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/MakeCustomIncludes.step1.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/MakeCustomIncludes.h" [[
+inline int MakeCustomIncludes() { return 1; }
+]])
diff --git a/Tests/RunCMake/BuildDepends/MakeCustomIncludes.step2.cmake b/Tests/RunCMake/BuildDepends/MakeCustomIncludes.step2.cmake
new file mode 100644
index 0000000..6b3151d
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/MakeCustomIncludes.step2.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/MakeCustomIncludes.h" [[
+inline int MakeCustomIncludes() { return 2; }
+]])
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
index 67a6101..9941c70 100644
--- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -43,9 +43,11 @@ endif()
run_BuildDepends(Custom-Symbolic-and-Byproduct)
run_BuildDepends(Custom-Always)
-if(RunCMake_GENERATOR MATCHES "Make" AND
- NOT "${RunCMake_BINARY_DIR}" STREQUAL "${RunCMake_SOURCE_DIR}")
- run_BuildDepends(MakeInProjectOnly)
+if(RunCMake_GENERATOR MATCHES "Make")
+ run_BuildDepends(MakeCustomIncludes)
+ if(NOT "${RunCMake_BINARY_DIR}" STREQUAL "${RunCMake_SOURCE_DIR}")
+ run_BuildDepends(MakeInProjectOnly)
+ endif()
endif()
function(run_ReGeneration)
diff --git a/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt
new file mode 100644
index 0000000..048762d
--- /dev/null
+++ b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0019-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0019 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt
new file mode 100644
index 0000000..edeb337
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0026-CONFIG-LOCATION-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0026 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt
new file mode 100644
index 0000000..32ff698
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0026-LOCATION-CONFIG-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0026 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt
new file mode 100644
index 0000000..b3f79fc
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0026-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0026 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt b/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt
new file mode 100644
index 0000000..157a046
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at clear-cached-information.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0026 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt
new file mode 100644
index 0000000..b7a0755
--- /dev/null
+++ b/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0028-OLD-iface.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0028 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt
new file mode 100644
index 0000000..586a876
--- /dev/null
+++ b/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0028-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0028 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 7db5243..cf778b6 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -199,6 +199,7 @@ add_RunCMake_test(ctest_start)
add_RunCMake_test(ctest_submit)
add_RunCMake_test(ctest_test)
add_RunCMake_test(ctest_disabled_test)
+add_RunCMake_test(ctest_skipped_test)
add_RunCMake_test(ctest_upload)
add_RunCMake_test(ctest_fixtures)
add_RunCMake_test(file)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt
new file mode 100644
index 0000000..430c865
--- /dev/null
+++ b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0029-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0029 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt
index e95e16f..d00b827 100644
--- a/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt
+++ b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt
@@ -1,4 +1,15 @@
-^CMake Error at CMP0030-OLD.cmake:2 \(use_mangled_mesa\):
+^CMake Deprecation Warning at CMP0030-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0030 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0030-OLD.cmake:2 \(use_mangled_mesa\):
use_mangled_mesa called with incorrect number of arguments
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt
new file mode 100644
index 0000000..d7ccedb
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0026-LOCATION.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0026 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/ctest_disabled_test/DisableCleanupTest-stdout.txt b/Tests/RunCMake/ctest_disabled_test/DisableCleanupTest-stdout.txt
index ee0dc51..9449e65 100644
--- a/Tests/RunCMake/ctest_disabled_test/DisableCleanupTest-stdout.txt
+++ b/Tests/RunCMake/ctest_disabled_test/DisableCleanupTest-stdout.txt
@@ -7,5 +7,5 @@
+
Total Test time \(real\) = +[0-9.]+ sec
+
-The following tests are disabled and did not run:
-.*2 \- CleanupTest
+The following tests did not run:
+.*2 \- CleanupTest \(Disabled\)
diff --git a/Tests/RunCMake/ctest_disabled_test/DisableFailingTest-stdout.txt b/Tests/RunCMake/ctest_disabled_test/DisableFailingTest-stdout.txt
index e2c9f92..486722e 100644
--- a/Tests/RunCMake/ctest_disabled_test/DisableFailingTest-stdout.txt
+++ b/Tests/RunCMake/ctest_disabled_test/DisableFailingTest-stdout.txt
@@ -2,8 +2,8 @@
+
Total Test time \(real\) = +[0-9.]+ sec
+
-The following tests are disabled and did not run:
-.*3 \- DisabledFailingTest
+The following tests did not run:
+.*3 \- DisabledFailingTest \(Disabled\)
+
The following tests FAILED:
.*2 \- FailingTest \(Failed\)
diff --git a/Tests/RunCMake/ctest_disabled_test/DisableNotRunTest-stdout.txt b/Tests/RunCMake/ctest_disabled_test/DisableNotRunTest-stdout.txt
index d8bf966..9078aeb 100644
--- a/Tests/RunCMake/ctest_disabled_test/DisableNotRunTest-stdout.txt
+++ b/Tests/RunCMake/ctest_disabled_test/DisableNotRunTest-stdout.txt
@@ -10,8 +10,8 @@
+
Total Test time \(real\) = +[0-9.]+ sec
+
-The following tests are disabled and did not run:
-.*2 \- DisabledTest
+The following tests did not run:
+.*2 \- DisabledTest \(Disabled\)
+
The following tests FAILED:
.*3 - NotRunTest \(Not Run\)
diff --git a/Tests/RunCMake/ctest_disabled_test/DisableRequiredTest-stdout.txt b/Tests/RunCMake/ctest_disabled_test/DisableRequiredTest-stdout.txt
index 886efb8..10d385e 100644
--- a/Tests/RunCMake/ctest_disabled_test/DisableRequiredTest-stdout.txt
+++ b/Tests/RunCMake/ctest_disabled_test/DisableRequiredTest-stdout.txt
@@ -9,5 +9,5 @@
+
Total Test time \(real\) = +[0-9.]+ sec
+
-The following tests are disabled and did not run:
-.*2 \- DisabledTest
+The following tests did not run:
+.*2 \- DisabledTest \(Disabled\)
diff --git a/Tests/RunCMake/ctest_disabled_test/DisableSetupTest-stdout.txt b/Tests/RunCMake/ctest_disabled_test/DisableSetupTest-stdout.txt
index dc27950..2dfd10d 100644
--- a/Tests/RunCMake/ctest_disabled_test/DisableSetupTest-stdout.txt
+++ b/Tests/RunCMake/ctest_disabled_test/DisableSetupTest-stdout.txt
@@ -9,5 +9,5 @@
+
Total Test time \(real\) = +[0-9.]+ sec
+
-The following tests are disabled and did not run:
-.*2 \- DisabledTest
+The following tests did not run:
+.*2 \- DisabledTest \(Disabled\)
diff --git a/Tests/RunCMake/ctest_disabled_test/DisabledTest-stdout.txt b/Tests/RunCMake/ctest_disabled_test/DisabledTest-stdout.txt
index d8bf966..9078aeb 100644
--- a/Tests/RunCMake/ctest_disabled_test/DisabledTest-stdout.txt
+++ b/Tests/RunCMake/ctest_disabled_test/DisabledTest-stdout.txt
@@ -10,8 +10,8 @@
+
Total Test time \(real\) = +[0-9.]+ sec
+
-The following tests are disabled and did not run:
-.*2 \- DisabledTest
+The following tests did not run:
+.*2 \- DisabledTest \(Disabled\)
+
The following tests FAILED:
.*3 - NotRunTest \(Not Run\)
diff --git a/Tests/RunCMake/ctest_skipped_test/CMakeLists.txt.in b/Tests/RunCMake/ctest_skipped_test/CMakeLists.txt.in
new file mode 100644
index 0000000..cc4b8ed
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/CMakeLists.txt.in
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.8)
+project(@CASE_NAME@ C)
+include(CTest)
+
+if (WIN32)
+ set(skip_command "@CMAKE_CURRENT_LIST_DIR@/skip.bat")
+else ()
+ set(skip_command "@CMAKE_CURRENT_LIST_DIR@/skip.sh")
+endif ()
+
+add_test(NAME SuccessfulTest COMMAND "${CMAKE_COMMAND}" --version)
+@CASE_CMAKELISTS_SUFFIX_CODE@
diff --git a/Tests/RunCMake/ctest_skipped_test/CTestConfig.cmake.in b/Tests/RunCMake/ctest_skipped_test/CTestConfig.cmake.in
new file mode 100644
index 0000000..c0d7e42
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/CTestConfig.cmake.in
@@ -0,0 +1 @@
+set(CTEST_PROJECT_NAME "@CASE_NAME@")
diff --git a/Tests/RunCMake/ctest_skipped_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_skipped_test/RunCMakeTest.cmake
new file mode 100644
index 0000000..dcf5cd4
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/RunCMakeTest.cmake
@@ -0,0 +1,51 @@
+include(RunCTest)
+
+function(run_SkipTest)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME SkipTest COMMAND ${skip_command})
+
+set_tests_properties(SkipTest PROPERTIES SKIP_RETURN_CODE 125)
+ ]])
+ run_ctest(SkipTest)
+endfunction()
+run_SkipTest()
+
+function(run_SkipSetupTest)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME SkipTest COMMAND ${skip_command})
+add_test(NAME SuccessfulCleanupTest COMMAND "${CMAKE_COMMAND}" --version)
+
+set_tests_properties(SkipTest PROPERTIES SKIP_RETURN_CODE 125
+ FIXTURES_SETUP "Foo")
+set_tests_properties(SuccessfulTest PROPERTIES FIXTURES_REQUIRED "Foo")
+set_tests_properties(SuccessfulCleanupTest PROPERTIES FIXTURES_CLEANUP "Foo")
+ ]])
+ run_ctest(SkipSetupTest)
+endfunction()
+run_SkipSetupTest()
+
+function(run_SkipRequiredTest)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME SkipTest COMMAND ${skip_command})
+add_test(NAME SuccessfulCleanupTest COMMAND "${CMAKE_COMMAND}" --version)
+
+set_tests_properties(SuccessfulTest PROPERTIES FIXTURES_SETUP "Foo")
+set_tests_properties(SkipTest PROPERTIES SKIP_RETURN_CODE 125
+ FIXTURES_REQUIRED "Foo")
+set_tests_properties(SuccessfulCleanupTest PROPERTIES FIXTURES_CLEANUP "Foo")
+ ]])
+ run_ctest(SkipRequiredTest)
+endfunction()
+run_SkipRequiredTest()
+
+function(run_SkipCleanupTest)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME CleanupTest COMMAND ${skip_command})
+
+set_tests_properties(SuccessfulTest PROPERTIES FIXTURES_REQUIRED "Foo")
+set_tests_properties(CleanupTest PROPERTIES SKIP_RETURN_CODE 125
+ FIXTURES_CLEANUP "Foo")
+ ]])
+ run_ctest(SkipCleanupTest)
+endfunction()
+run_SkipCleanupTest()
diff --git a/Tests/RunCMake/ctest_skipped_test/SkipCleanupTest-stdout.txt b/Tests/RunCMake/ctest_skipped_test/SkipCleanupTest-stdout.txt
new file mode 100644
index 0000000..3b14b7a
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/SkipCleanupTest-stdout.txt
@@ -0,0 +1,11 @@
+ Start 1: SuccessfulTest
+1/2 Test #1: SuccessfulTest ................... Passed +[0-9.]+ sec
+ Start 2: CleanupTest
+2/2 Test #2: CleanupTest ......................\*\*\*\Skipped +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 2
++
+Total Test time \(real\) = +[0-9.]+ sec
++
+The following tests did not run:
+.*2 \- CleanupTest \(Skipped\)
diff --git a/Tests/RunCMake/ctest_skipped_test/SkipRequiredTest-stdout.txt b/Tests/RunCMake/ctest_skipped_test/SkipRequiredTest-stdout.txt
new file mode 100644
index 0000000..8ecc6e3
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/SkipRequiredTest-stdout.txt
@@ -0,0 +1,13 @@
+ Start 1: SuccessfulTest
+1/3 Test #1: SuccessfulTest ................... Passed +[0-9.]+ sec
+ Start 2: SkipTest
+2/3 Test #2: SkipTest .........................\*\*\*\Skipped +[0-9.]+ sec
+ Start 3: SuccessfulCleanupTest
+3/3 Test #3: SuccessfulCleanupTest ............ Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 3
++
+Total Test time \(real\) = +[0-9.]+ sec
++
+The following tests did not run:
+.*2 \- SkipTest \(Skipped\)
diff --git a/Tests/RunCMake/ctest_skipped_test/SkipSetupTest-stdout.txt b/Tests/RunCMake/ctest_skipped_test/SkipSetupTest-stdout.txt
new file mode 100644
index 0000000..fe9bf34
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/SkipSetupTest-stdout.txt
@@ -0,0 +1,13 @@
+ Start 2: SkipTest
+1/3 Test #2: SkipTest .........................\*\*\*\Skipped +[0-9.]+ sec
+ Start 1: SuccessfulTest
+2/3 Test #1: SuccessfulTest ................... Passed +[0-9.]+ sec
+ Start 3: SuccessfulCleanupTest
+3/3 Test #3: SuccessfulCleanupTest ............ Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 3
++
+Total Test time \(real\) = +[0-9.]+ sec
++
+The following tests did not run:
+.*2 \- SkipTest \(Skipped\)
diff --git a/Tests/RunCMake/ctest_skipped_test/SkipTest-stdout.txt b/Tests/RunCMake/ctest_skipped_test/SkipTest-stdout.txt
new file mode 100644
index 0000000..52e7a0b
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/SkipTest-stdout.txt
@@ -0,0 +1,11 @@
+ Start 1: SuccessfulTest
+1/2 Test #1: SuccessfulTest ................... Passed +[0-9.]+ sec
+ Start 2: SkipTest
+2/2 Test #2: SkipTest .........................\*\*\*\Skipped +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 2
++
+Total Test time \(real\) = +[0-9.]+ sec
++
+The following tests did not run:
+.*2 \- SkipTest \(Skipped\)
diff --git a/Tests/RunCMake/ctest_skipped_test/skip.bat b/Tests/RunCMake/ctest_skipped_test/skip.bat
new file mode 100755
index 0000000..80e1290
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/skip.bat
@@ -0,0 +1 @@
+EXIT 125
diff --git a/Tests/RunCMake/ctest_skipped_test/skip.sh b/Tests/RunCMake/ctest_skipped_test/skip.sh
new file mode 100755
index 0000000..f9c4603
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/skip.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exit 125
diff --git a/Tests/RunCMake/ctest_skipped_test/test.cmake.in b/Tests/RunCMake/ctest_skipped_test/test.cmake.in
new file mode 100644
index 0000000..ca23c83
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/test.cmake.in
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.7)
+
+set(CTEST_SITE "test-site")
+set(CTEST_BUILD_NAME "test-build-name")
+set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@")
+set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
+set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
+set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
+set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
+set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
+
+set(ctest_test_args "@CASE_CTEST_TEST_ARGS@")
+ctest_start(Experimental)
+ctest_configure()
+ctest_build()
+ctest_test(${ctest_test_args})
diff --git a/Tests/XCTest/CMakeLists.txt b/Tests/XCTest/CMakeLists.txt
index e866623..d40c40e 100644
--- a/Tests/XCTest/CMakeLists.txt
+++ b/Tests/XCTest/CMakeLists.txt
@@ -55,3 +55,19 @@ xctest_add_bundle(CocoaExampleTests CocoaExample
CocoaExampleTests/CocoaExampleTests.m)
xctest_add_test(XCTest.CocoaExample CocoaExampleTests)
+
+# Static lib
+
+add_library(StaticLibExample STATIC
+ StaticLibExample/StaticLibExample.h
+ StaticLibExample/StaticLibExample.c
+)
+
+target_include_directories(StaticLibExample PUBLIC .)
+
+# XCTest for Static lib
+
+xctest_add_bundle(StaticLibExampleTests StaticLibExample
+ StaticLibExampleTests/StaticLibExampleTests.m)
+
+xctest_add_test(XCTest.StaticLibExample StaticLibExampleTests)
diff --git a/Tests/XCTest/StaticLibExample/StaticLibExample.c b/Tests/XCTest/StaticLibExample/StaticLibExample.c
new file mode 100644
index 0000000..b198f80
--- /dev/null
+++ b/Tests/XCTest/StaticLibExample/StaticLibExample.c
@@ -0,0 +1,6 @@
+#include "StaticLibExample.h"
+
+int FourtyFour()
+{
+ return 44;
+}
diff --git a/Tests/XCTest/StaticLibExample/StaticLibExample.h b/Tests/XCTest/StaticLibExample/StaticLibExample.h
new file mode 100644
index 0000000..147a909
--- /dev/null
+++ b/Tests/XCTest/StaticLibExample/StaticLibExample.h
@@ -0,0 +1 @@
+int FourtyFour();
diff --git a/Tests/XCTest/StaticLibExampleTests/Info.plist b/Tests/XCTest/StaticLibExampleTests/Info.plist
new file mode 100644
index 0000000..6ad9a27
--- /dev/null
+++ b/Tests/XCTest/StaticLibExampleTests/Info.plist
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>StaticLibExampleTests</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.cmake.StaticLibExampleTests</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>StaticLibExampleTests</string>
+ <key>CFBundlePackageType</key>
+ <string>BNDL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+</dict>
+</plist>
diff --git a/Tests/XCTest/StaticLibExampleTests/StaticLibExampleTests.m b/Tests/XCTest/StaticLibExampleTests/StaticLibExampleTests.m
new file mode 100644
index 0000000..5f8a769
--- /dev/null
+++ b/Tests/XCTest/StaticLibExampleTests/StaticLibExampleTests.m
@@ -0,0 +1,16 @@
+#import <XCTest/XCTest.h>
+
+#import "StaticLibExample/StaticLibExample.h"
+
+@interface StaticLibExampleTests : XCTestCase
+
+@end
+
+@implementation StaticLibExampleTests
+
+- (void)testFourtyFour {
+ // This is an example of a functional test case.
+ XCTAssertEqual(44, FourtyFour());
+}
+
+@end