[flang][openacc][NFC] Merge acc-declare.f90 tests (#73055)
[llvm-project.git] / pstl / test / CMakeLists.txt
blobbc027c30d085fb18c2da7dddd7cf7dacb28b599b
1 #===-- CMakeLists.txt ----------------------------------------------------===##
3 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 # See https://llvm.org/LICENSE.txt for license information.
5 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 #===----------------------------------------------------------------------===##
9 # TODO(ldionne): This CMake testing infrastructure should be replaced with a
10 #                llvm-lit test suite.
12 add_custom_target(pstl-build-tests
13     COMMENT "Build all the pstl tests.")
15 add_custom_target(check-pstl
16     COMMAND "${CMAKE_CTEST_COMMAND}" --output-on-failure
17     USES_TERMINAL
18     DEPENDS pstl-build-tests
19     COMMENT "Build and run all the unit tests.")
21 add_library(test_stdlib INTERFACE)
22 target_include_directories(test_stdlib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/support/stdlib")
23 target_link_libraries(test_stdlib INTERFACE pstl::ParallelSTL)
24 target_compile_options(test_stdlib INTERFACE -Wno-gnu-include-next)
26 file(GLOB_RECURSE UNIT_TESTS "*.pass.cpp")
27 foreach(_file IN LISTS UNIT_TESTS)
28     file(RELATIVE_PATH _target "${CMAKE_CURRENT_SOURCE_DIR}" "${_file}")
29     string(REPLACE ".cpp" "" _target "${_target}")
30     string(REPLACE "/" "-" _target "${_target}")
31     set(_target "pstl-${_target}")
33     add_executable(${_target} EXCLUDE_FROM_ALL "${_file}")
34     target_include_directories(${_target} PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
35     target_compile_options(${_target} PRIVATE -Wno-unused-local-typedef -Wno-unused-variable)
36     target_link_libraries(${_target} PRIVATE test_stdlib)
37     set_target_properties(${_target} PROPERTIES CXX_EXTENSIONS NO
38                                                 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
39     add_test(${_target} "${CMAKE_CURRENT_BINARY_DIR}/${_target}")
40     add_dependencies(pstl-build-tests ${_target})
41 endforeach()