]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/ratio/test/CMakeLists.txt
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / ratio / test / CMakeLists.txt
CommitLineData
92f5a8d4
TL
1# Copyright 2019 Mike Dev
2# Distributed under the Boost Software License, Version 1.0.
3# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
4#
5# NOTE: CMake support for Boost.Ratio is currently experimental at best
6# and this file runs only a subset of the unit tests
7# (in particular none of the fail tests)
8
1e59de90
TL
9# Attach all our tests to the `tests` target, to enable
10# `cmake --build . --target tests`
11if(NOT TARGET tests)
12 add_custom_target(tests)
13endif()
92f5a8d4
TL
14
15## unit tests
16
17# list of tests that contain a main function
18set( exec_test_files ratio_ext_pass;ratio_io_pass;ratio_pass )
19file( GLOB_RECURSE test_files *_pass.cpp )
20foreach( file IN LISTS test_files )
21
22 get_filename_component( core_name ${file} NAME_WE )
1e59de90 23 set( test_name boost_ratio-test-${core_name} )
92f5a8d4
TL
24
25 if( ${core_name} IN_LIST exec_test_files )
1e59de90 26 add_executable( ${test_name} EXCLUDE_FROM_ALL ${file} )
92f5a8d4
TL
27 add_test( NAME ${test_name} COMMAND ${test_name} )
28 else()
29 # most tests are compile only, so we just need to create an object file
30 # in order to see, if it compiles
1e59de90 31 add_library( ${test_name} STATIC EXCLUDE_FROM_ALL ${file})
92f5a8d4
TL
32 endif()
33
1e59de90
TL
34 add_dependencies(tests ${test_name})
35
92f5a8d4
TL
36 target_link_libraries( ${test_name} PUBLIC
37 Boost::ratio
38 )
39
40endforeach()
41
42## examples
43file( GLOB_RECURSE test_files ../example/*.cpp )
44foreach( file IN LISTS test_files )
45
46 get_filename_component( core_name ${file} NAME_WE )
1e59de90
TL
47 set( test_name boost_ratio-example-${core_name} )
48
49 add_executable( ${test_name} EXCLUDE_FROM_ALL ${file} )
92f5a8d4 50
92f5a8d4 51 target_link_libraries( ${test_name} PUBLIC
1e59de90 52 Boost::ratio Boost::chrono
92f5a8d4 53 )
1e59de90
TL
54
55 add_dependencies(tests ${test_name})
56
92f5a8d4
TL
57 add_test( NAME ${test_name} COMMAND ${test_name} )
58
59endforeach()