summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/ratio/test/CMakeLists.txt
blob: 0a49e9f75b088390784b00d4bb71f83f8a690b40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Copyright 2019 Mike Dev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
#
# NOTE: CMake support for Boost.Ratio is currently experimental at best
#       and this file runs only a subset of the unit tests
#       (in particular none of the fail tests)


## unit tests

# list of tests that contain a main function
set( exec_test_files ratio_ext_pass;ratio_io_pass;ratio_pass )
file( GLOB_RECURSE test_files *_pass.cpp )
foreach( file IN LISTS test_files )

    get_filename_component( core_name ${file} NAME_WE )
    set( test_name test_boost_ratio_${core_name} )

    if( ${core_name} IN_LIST exec_test_files )
        add_executable( ${test_name} ${file} )
        add_test( NAME ${test_name} COMMAND ${test_name} )
    else()
        # most tests are compile only, so we just need to create an object file
        # in order to see, if it compiles
        add_library( ${test_name} STATIC ${file})
    endif()

    target_link_libraries( ${test_name} PUBLIC
        Boost::ratio
    )

endforeach()

## examples
file( GLOB_RECURSE test_files ../example/*.cpp )
foreach( file IN LISTS test_files )

    get_filename_component( core_name ${file} NAME_WE )
    set( test_name test_boost_ratio_${core_name} )

    add_executable( ${test_name} ${file} )
    target_link_libraries( ${test_name} PUBLIC
        Boost::ratio
    )
    add_test( NAME ${test_name} COMMAND ${test_name} )

endforeach()