mirror of
https://github.com/boostorg/boost_install.git
synced 2026-07-21 13:13:30 +00:00
Make test/random use an intermediate library that links to Boost::random privately
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Copyright 2018, 2019 Peter Dimov
|
||||
# Copyright 2018-2020 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -28,8 +28,11 @@ else()
|
||||
|
||||
endif()
|
||||
|
||||
add_executable(main quick.cpp)
|
||||
target_link_libraries(main Boost::random)
|
||||
add_library(lib lib.cpp)
|
||||
target_link_libraries(lib PRIVATE Boost::random)
|
||||
|
||||
add_executable(main main.cpp)
|
||||
target_link_libraries(main PRIVATE lib Boost::headers)
|
||||
|
||||
enable_testing()
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
// Copyright 2017-2020 Peter Dimov.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
//
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/random/random_device.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
unsigned get_random_number()
|
||||
{
|
||||
boost::random::random_device dev;
|
||||
return dev();
|
||||
}
|
||||
@@ -1,19 +1,17 @@
|
||||
|
||||
// Copyright 2017, 2018 Peter Dimov.
|
||||
// Copyright 2017-2020 Peter Dimov.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
//
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/random/random_device.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
unsigned get_random_number();
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::random::random_device dev;
|
||||
|
||||
BOOST_TEST_NE( dev(), dev() );
|
||||
|
||||
BOOST_TEST_NE( get_random_number(), get_random_number() );
|
||||
return boost::report_errors();
|
||||
}
|
||||
Reference in New Issue
Block a user