mirror of
https://github.com/boostorg/ratio.git
synced 2025-05-12 05:51:46 +00:00
Update tests/CMakeLists.txt
This commit is contained in:
parent
2fde23eedf
commit
00073b7d58
@ -6,6 +6,11 @@
|
|||||||
# and this file runs only a subset of the unit tests
|
# and this file runs only a subset of the unit tests
|
||||||
# (in particular none of the fail tests)
|
# (in particular none of the fail tests)
|
||||||
|
|
||||||
|
# Attach all our tests to the `tests` target, to enable
|
||||||
|
# `cmake --build . --target tests`
|
||||||
|
if(NOT TARGET tests)
|
||||||
|
add_custom_target(tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
## unit tests
|
## unit tests
|
||||||
|
|
||||||
@ -18,14 +23,16 @@ foreach( file IN LISTS test_files )
|
|||||||
set( test_name boost_ratio-test-${core_name} )
|
set( test_name boost_ratio-test-${core_name} )
|
||||||
|
|
||||||
if( ${core_name} IN_LIST exec_test_files )
|
if( ${core_name} IN_LIST exec_test_files )
|
||||||
add_executable( ${test_name} ${file} )
|
add_executable( ${test_name} EXCLUDE_FROM_ALL ${file} )
|
||||||
add_test( NAME ${test_name} COMMAND ${test_name} )
|
add_test( NAME ${test_name} COMMAND ${test_name} )
|
||||||
else()
|
else()
|
||||||
# most tests are compile only, so we just need to create an object file
|
# most tests are compile only, so we just need to create an object file
|
||||||
# in order to see, if it compiles
|
# in order to see, if it compiles
|
||||||
add_library( ${test_name} STATIC ${file})
|
add_library( ${test_name} STATIC EXCLUDE_FROM_ALL ${file})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_dependencies(tests ${test_name})
|
||||||
|
|
||||||
target_link_libraries( ${test_name} PUBLIC
|
target_link_libraries( ${test_name} PUBLIC
|
||||||
Boost::ratio
|
Boost::ratio
|
||||||
)
|
)
|
||||||
@ -39,11 +46,14 @@ foreach( file IN LISTS test_files )
|
|||||||
get_filename_component( core_name ${file} NAME_WE )
|
get_filename_component( core_name ${file} NAME_WE )
|
||||||
set( test_name boost_ratio-example-${core_name} )
|
set( test_name boost_ratio-example-${core_name} )
|
||||||
|
|
||||||
add_executable( ${test_name} ${file} )
|
add_executable( ${test_name} EXCLUDE_FROM_ALL ${file} )
|
||||||
|
|
||||||
target_link_libraries( ${test_name} PUBLIC
|
target_link_libraries( ${test_name} PUBLIC
|
||||||
Boost::ratio Boost::chrono
|
Boost::ratio Boost::chrono
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_dependencies(tests ${test_name})
|
||||||
|
|
||||||
add_test( NAME ${test_name} COMMAND ${test_name} )
|
add_test( NAME ${test_name} COMMAND ${test_name} )
|
||||||
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user