File tree Expand file tree Collapse file tree 4 files changed +15
-14
lines changed
doc/modules/ROOT/examples Expand file tree Collapse file tree 4 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,9 @@ endif()
178178if (BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS)
179179 enable_testing ()
180180 add_subdirectory (test )
181+ if (BOOST_OPENMETHOD_IS_ROOT)
182+ add_custom_target (all_with_tests ALL DEPENDS tests)
183+ endif ()
181184endif ()
182185
183186#-------------------------------------------------
Original file line number Diff line number Diff line change @@ -18,10 +18,9 @@ endif()
1818file (GLOB cpp_files "*.cpp" )
1919
2020foreach (cpp ${cpp_files} )
21- cmake_path(REMOVE_EXTENSION cpp LAST_ONLY OUTPUT_VARIABLE stem)
22- string (REGEX REPLACE ".*/" "" stem ${stem} )
21+ get_filename_component (stem ${cpp} NAME_WE )
2322 add_executable (${stem} ${cpp} )
24- target_link_libraries (${stem} PUBLIC Boost::openmethod Boost::unit_test_framework)
23+ target_link_libraries (${stem} PRIVATE Boost::openmethod Boost::unit_test_framework)
2524 add_test (NAME ${stem} COMMAND ${stem} )
2625 add_dependencies (tests ${stem} )
2726endforeach ()
@@ -40,8 +39,8 @@ function(add_step_by_step dir)
4039 file (GLOB cpp_files "${subdir} /*.cpp" )
4140 set (target "${dir} _${subex} " )
4241 add_executable (${target} ${cpp_files} )
43- target_link_libraries (${target} PUBLIC Boost::openmethod)
44- set (output_dir " ${subdir} " )
42+ target_link_libraries (${target} PRIVATE Boost::openmethod)
43+ set (output_dir openmethod/ ${dir} / ${subex} )
4544 set_target_properties (${target} PROPERTIES
4645 RUNTIME_OUTPUT_DIRECTORY "${output_dir} "
4746 LIBRARY_OUTPUT_DIRECTORY "${output_dir} "
Original file line number Diff line number Diff line change @@ -35,14 +35,14 @@ endif()
3535add_library (indirect_shared SHARED indirect_extensions.cpp)
3636target_compile_definitions (
3737 indirect_shared PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
38- target_link_libraries (indirect_shared Boost::openmethod Boost::dll)
38+ target_link_libraries (indirect_shared PRIVATE Boost::openmethod Boost::dll)
3939set_target_properties (indirect_shared PROPERTIES ENABLE_EXPORTS ON )
4040
4141add_executable (indirect indirect_main.cpp)
4242target_compile_definitions (
4343 indirect PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
4444set_target_properties (indirect PROPERTIES ENABLE_EXPORTS ON )
45- target_link_libraries (indirect Boost::openmethod Boost::dll)
45+ target_link_libraries (indirect PRIVATE Boost::openmethod Boost::dll)
4646add_dependencies (indirect indirect_shared)
4747if (NOT WIN32 )
4848 add_test (NAME indirect_shared COMMAND indirect)
Original file line number Diff line number Diff line change 88# Official repository: https://github.com/boostorg/openmethod
99#
1010
11- message (STATUS "Building tests" )
11+ message (STATUS "Boost.OpenMethod: building tests" )
1212
1313if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
1414 add_compile_definitions (BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS)
@@ -56,16 +56,15 @@ endif()
5656file (GLOB test_cpp_files "test_*.cpp" )
5757
5858foreach (test_cpp ${test_cpp_files} )
59- cmake_path(REMOVE_EXTENSION test_cpp LAST_ONLY OUTPUT_VARIABLE test )
60- string (REGEX REPLACE ".*/" "" test ${test} )
61- add_executable (${test} ${test_cpp} )
62- target_link_libraries (${test} PUBLIC Boost::openmethod Boost::unit_test_framework)
59+ get_filename_component (test ${test_cpp} NAME_WE )
60+ add_executable (${test} EXCLUDE_FROM_ALL ${test_cpp} )
61+ target_link_libraries (${test} PRIVATE Boost::openmethod Boost::unit_test_framework)
6362 add_test (NAME ${test} COMMAND ${test} )
6463 add_dependencies (tests ${test} )
6564endforeach ()
6665
67- add_executable (test_mix_release_debug mix_release_debug/main.cpp mix_release_debug/lib.cpp)
68- target_link_libraries (test_mix_release_debug Boost::openmethod Boost::unit_test_framework)
66+ add_executable (test_mix_release_debug EXCLUDE_FROM_ALL mix_release_debug/main.cpp mix_release_debug/lib.cpp)
67+ target_link_libraries (test_mix_release_debug PRIVATE Boost::openmethod Boost::unit_test_framework)
6968add_test (NAME test_mix_release_debug COMMAND test_mix_release_debug)
7069add_dependencies (tests test_mix_release_debug)
7170
You can’t perform that action at this time.
0 commit comments