• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
9
10## unit tests
11
12# list of tests that contain a main function
13set( exec_test_files ratio_ext_pass;ratio_io_pass;ratio_pass )
14file( GLOB_RECURSE test_files *_pass.cpp )
15foreach( file IN LISTS test_files )
16
17    get_filename_component( core_name ${file} NAME_WE )
18    set( test_name test_boost_ratio_${core_name} )
19
20    if( ${core_name} IN_LIST exec_test_files )
21        add_executable( ${test_name} ${file} )
22        add_test( NAME ${test_name} COMMAND ${test_name} )
23    else()
24        # most tests are compile only, so we just need to create an object file
25        # in order to see, if it compiles
26        add_library( ${test_name} STATIC ${file})
27    endif()
28
29    target_link_libraries( ${test_name} PUBLIC
30        Boost::ratio
31    )
32
33endforeach()
34
35## examples
36file( GLOB_RECURSE test_files ../example/*.cpp )
37foreach( file IN LISTS test_files )
38
39    get_filename_component( core_name ${file} NAME_WE )
40    set( test_name test_boost_ratio_${core_name} )
41
42    add_executable( ${test_name} ${file} )
43    target_link_libraries( ${test_name} PUBLIC
44        Boost::ratio
45    )
46    add_test( NAME ${test_name} COMMAND ${test_name} )
47
48endforeach()
49
50