Skip to content

Commit 0bda0fe

Browse files
committed
CML: prefix targets with "boost_openmethod-"
1 parent 36d8832 commit 0bda0fe

File tree

3 files changed

+50
-46
lines changed

3 files changed

+50
-46
lines changed

doc/modules/ROOT/examples/CMakeLists.txt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,27 @@ file(GLOB cpp_files "*.cpp")
1919

2020
foreach (cpp ${cpp_files})
2121
get_filename_component(stem ${cpp} NAME_WE)
22-
add_executable(${stem} ${cpp})
23-
target_link_libraries(${stem} PRIVATE Boost::openmethod Boost::unit_test_framework)
24-
add_test(NAME ${stem} COMMAND ${stem})
25-
add_dependencies(tests ${stem})
22+
set(test_target "boost_openmethod-${stem}")
23+
add_executable(${test_target} ${cpp})
24+
target_link_libraries(${test_target} PRIVATE Boost::openmethod Boost::unit_test_framework)
25+
add_test(NAME ${test_target} COMMAND ${test_target})
26+
add_dependencies(tests ${test_target})
2627
endforeach()
2728

28-
function(add_step_by_step dir)
29+
function(boost_openmethod_add_step_by_step dir)
2930
set(add_test "")
3031
if(ARGC GREATER 1)
3132
set(add_test "${ARGV1}")
3233
else()
3334
set(add_test "ON")
3435
endif()
36+
3537
file(GLOB subdirs "${dir}/*")
3638

3739
foreach (subdir ${subdirs})
3840
string(REGEX REPLACE ".*/" "" subex ${subdir})
3941
file(GLOB cpp_files "${subdir}/*.cpp")
40-
set(target "${dir}_${subex}")
42+
set(target "boost_openmethod-${dir}_${subex}")
4143
add_executable(${target} ${cpp_files})
4244
target_link_libraries(${target} PRIVATE Boost::openmethod)
4345
set(output_dir openmethod/${dir}/${subex})
@@ -53,11 +55,11 @@ function(add_step_by_step dir)
5355
endforeach()
5456
endfunction()
5557

56-
add_step_by_step(rolex)
57-
add_step_by_step(ambiguities OFF)
58-
add_step_by_step(core_api)
59-
add_step_by_step(custom_rtti)
60-
add_step_by_step(virtual_ptr_alt)
58+
boost_openmethod_add_step_by_step(rolex)
59+
boost_openmethod_add_step_by_step(ambiguities OFF)
60+
boost_openmethod_add_step_by_step(core_api)
61+
boost_openmethod_add_step_by_step(custom_rtti)
62+
boost_openmethod_add_step_by_step(virtual_ptr_alt)
6163

6264
if (NOT WIN32)
6365
add_subdirectory(shared_libs)

doc/modules/ROOT/examples/shared_libs/CMakeLists.txt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,40 @@ add_compile_definitions(BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS)
1010
# ------------------------------------------------------------------------------
1111
# static linking
1212

13-
add_library(shared SHARED extensions.cpp)
14-
target_link_libraries(shared Boost::openmethod)
15-
set_target_properties(shared PROPERTIES ENABLE_EXPORTS ON)
13+
add_library(boost_openmethod-shared SHARED extensions.cpp)
14+
target_link_libraries(boost_openmethod-shared Boost::openmethod)
15+
set_target_properties(boost_openmethod-shared PROPERTIES ENABLE_EXPORTS ON)
1616

17-
add_executable(static static_main.cpp)
18-
target_link_libraries(static Boost::openmethod Boost::dll shared)
19-
add_test(NAME static_shared COMMAND static)
17+
add_executable(boost_openmethod-static static_main.cpp)
18+
target_link_libraries(boost_openmethod-static Boost::openmethod Boost::dll boost_openmethod-shared)
19+
add_test(NAME boost_openmethod-static COMMAND boost_openmethod-static)
2020

2121
# ------------------------------------------------------------------------------
2222
# dynamic loading, direct virtual_ptrs
2323

24-
add_executable(dynamic dynamic_main.cpp)
25-
set_target_properties(dynamic PROPERTIES ENABLE_EXPORTS ON)
26-
target_link_libraries(dynamic Boost::openmethod Boost::dll)
27-
add_dependencies(dynamic shared)
24+
add_executable(boost_openmethod-dynamic dynamic_main.cpp)
25+
set_target_properties(boost_openmethod-dynamic PROPERTIES ENABLE_EXPORTS ON)
26+
target_link_libraries(boost_openmethod-dynamic Boost::openmethod Boost::dll)
27+
add_dependencies(boost_openmethod-dynamic boost_openmethod-shared)
2828
if (NOT WIN32)
29-
add_test(NAME dynamic_shared COMMAND dynamic)
29+
add_test(NAME boost_openmethod-dynamic COMMAND boost_openmethod-dynamic)
3030
endif()
3131

3232
# ------------------------------------------------------------------------------
3333
# dynamic loading, indirect virtual_ptrs
3434

35-
add_library(indirect_shared SHARED indirect_extensions.cpp)
35+
add_library(boost_openmethod-indirect_shared SHARED indirect_extensions.cpp)
3636
target_compile_definitions(
37-
indirect_shared PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
38-
target_link_libraries(indirect_shared PRIVATE Boost::openmethod Boost::dll)
39-
set_target_properties(indirect_shared PROPERTIES ENABLE_EXPORTS ON)
37+
boost_openmethod-indirect_shared PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
38+
target_link_libraries(boost_openmethod-indirect_shared PRIVATE Boost::openmethod Boost::dll)
39+
set_target_properties(boost_openmethod-indirect_shared PROPERTIES ENABLE_EXPORTS ON)
4040

41-
add_executable(indirect indirect_main.cpp)
41+
add_executable(boost_openmethod-indirect indirect_main.cpp)
4242
target_compile_definitions(
43-
indirect PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
44-
set_target_properties(indirect PROPERTIES ENABLE_EXPORTS ON)
45-
target_link_libraries(indirect PRIVATE Boost::openmethod Boost::dll)
46-
add_dependencies(indirect indirect_shared)
43+
boost_openmethod-indirect PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
44+
set_target_properties(boost_openmethod-indirect PROPERTIES ENABLE_EXPORTS ON)
45+
target_link_libraries(boost_openmethod-indirect PRIVATE Boost::openmethod Boost::dll)
46+
add_dependencies(boost_openmethod-indirect boost_openmethod-indirect_shared)
4747
if (NOT WIN32)
48-
add_test(NAME indirect_shared COMMAND indirect)
48+
add_test(NAME boost_openmethod-indirect COMMAND boost_openmethod-indirect)
4949
endif()

test/CMakeLists.txt

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,26 @@ file(GLOB test_cpp_files "test_*.cpp")
5757

5858
foreach(test_cpp ${test_cpp_files})
5959
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)
62-
add_test(NAME ${test} COMMAND ${test})
63-
add_dependencies(tests ${test})
60+
set(test_target "boost_openmethod-${test}")
61+
add_executable(${test_target} EXCLUDE_FROM_ALL ${test_cpp})
62+
target_link_libraries(${test_target} PRIVATE Boost::openmethod Boost::unit_test_framework)
63+
add_test(NAME ${test_target} COMMAND ${test_target})
64+
add_dependencies(tests ${test_target})
6465
endforeach()
6566

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)
68-
add_test(NAME test_mix_release_debug COMMAND test_mix_release_debug)
69-
add_dependencies(tests test_mix_release_debug)
67+
add_executable(boost_openmethod-test_mix_release_debug EXCLUDE_FROM_ALL mix_release_debug/main.cpp mix_release_debug/lib.cpp)
68+
target_link_libraries(boost_openmethod-test_mix_release_debug PRIVATE Boost::openmethod Boost::unit_test_framework)
69+
add_test(NAME boost_openmethod-test_mix_release_debug COMMAND boost_openmethod-test_mix_release_debug)
70+
add_dependencies(tests boost_openmethod-test_mix_release_debug)
7071

7172
function(openmethod_compile_fail_test testname fail_regex)
72-
add_library("compile-fail-${testname}" STATIC EXCLUDE_FROM_ALL "${testname}.cpp")
73-
target_link_libraries("compile-fail-${testname}" PRIVATE Boost::openmethod)
74-
add_test(
75-
NAME "openmethod-${testname}"
76-
COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target "compile-fail-${testname}" --config $<CONFIG>)
77-
set_property(TEST "openmethod-${testname}" PROPERTY PASS_REGULAR_EXPRESSION "${fail_regex}")
73+
set(test_target "boost_openmethod-${testname}")
74+
add_library(${test_target} STATIC EXCLUDE_FROM_ALL "${testname}.cpp")
75+
target_link_libraries(${test_target} PRIVATE Boost::openmethod)
76+
add_test(
77+
NAME "${test_target}"
78+
COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target "${test_target}" --config $<CONFIG>)
79+
set_property(TEST "${test_target}" PROPERTY PASS_REGULAR_EXPRESSION "${fail_regex}")
7880
endfunction()
7981

8082
openmethod_compile_fail_test(

0 commit comments

Comments
 (0)