annotate pstl/test/CMakeLists.txt @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 #===-- CMakeLists.txt ----------------------------------------------------===##
anatofuz
parents:
diff changeset
2 #
anatofuz
parents:
diff changeset
3 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 # See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 #
anatofuz
parents:
diff changeset
7 #===----------------------------------------------------------------------===##
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 # TODO(ldionne): This CMake testing infrastructure should be replaced with a
anatofuz
parents:
diff changeset
10 # llvm-lit test suite.
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 add_custom_target(pstl-build-tests
anatofuz
parents:
diff changeset
13 COMMENT "Build all the pstl tests.")
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 add_custom_target(check-pstl
anatofuz
parents:
diff changeset
16 COMMAND "${CMAKE_CTEST_COMMAND}" --output-on-failure
anatofuz
parents:
diff changeset
17 USES_TERMINAL
anatofuz
parents:
diff changeset
18 DEPENDS pstl-build-tests
anatofuz
parents:
diff changeset
19 COMMENT "Build and run all the unit tests.")
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 add_library(test_stdlib INTERFACE)
anatofuz
parents:
diff changeset
22 target_include_directories(test_stdlib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/support/stdlib")
anatofuz
parents:
diff changeset
23 target_link_libraries(test_stdlib INTERFACE pstl::ParallelSTL)
anatofuz
parents:
diff changeset
24 target_compile_options(test_stdlib INTERFACE -Wno-gnu-include-next)
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 file(GLOB_RECURSE UNIT_TESTS "*.pass.cpp")
anatofuz
parents:
diff changeset
27 foreach(_file IN LISTS UNIT_TESTS)
anatofuz
parents:
diff changeset
28 file(RELATIVE_PATH _target "${CMAKE_CURRENT_SOURCE_DIR}" "${_file}")
anatofuz
parents:
diff changeset
29 string(REPLACE ".cpp" "" _target "${_target}")
anatofuz
parents:
diff changeset
30 string(REPLACE "/" "-" _target "${_target}")
anatofuz
parents:
diff changeset
31 set(_target "pstl-${_target}")
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 add_executable(${_target} EXCLUDE_FROM_ALL "${_file}")
anatofuz
parents:
diff changeset
34 target_include_directories(${_target} PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
anatofuz
parents:
diff changeset
35 target_compile_options(${_target} PRIVATE -Wno-unused-local-typedef -Wno-unused-variable)
anatofuz
parents:
diff changeset
36 target_link_libraries(${_target} PRIVATE test_stdlib)
anatofuz
parents:
diff changeset
37 set_target_properties(${_target} PROPERTIES CXX_EXTENSIONS NO
anatofuz
parents:
diff changeset
38 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
anatofuz
parents:
diff changeset
39 add_test(${_target} "${CMAKE_CURRENT_BINARY_DIR}/${_target}")
anatofuz
parents:
diff changeset
40 add_dependencies(pstl-build-tests ${_target})
anatofuz
parents:
diff changeset
41 endforeach()