summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/release/dev/ctest_test-ignore-skipped-tests.rst7
-rw-r--r--Modules/FindOpenMP.cmake535
-rw-r--r--Modules/FindXCTest.cmake4
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestRunTest.cxx8
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx16
-rw-r--r--Source/cmGlobalVisualStudio15Generator.cxx2
-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/CMakeLists.txt1
-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
38 files changed, 753 insertions, 227 deletions
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/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 61e71b2..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 20170426)
+set(CMake_VERSION_PATCH 20170427)
#set(CMake_VERSION_RC 1)
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 c5a4faa..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(
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/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/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/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