Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ endif()
if (BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
if (BOOST_OPENMETHOD_IS_ROOT)
add_custom_target(all_with_tests ALL DEPENDS tests)
endif()
endif ()

#-------------------------------------------------
Expand Down
11 changes: 5 additions & 6 deletions doc/modules/ROOT/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)

message(STATUS "Building examples")
message(STATUS "Boost.OpenMethod: building examples")

if (CMAKE_BUILD_TYPE STREQUAL "Release")
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand All @@ -18,10 +18,9 @@ endif()
file(GLOB cpp_files "*.cpp")

foreach (cpp ${cpp_files})
cmake_path(REMOVE_EXTENSION cpp LAST_ONLY OUTPUT_VARIABLE stem)
string(REGEX REPLACE ".*/" "" stem ${stem})
get_filename_component(stem ${cpp} NAME_WE)
add_executable(${stem} ${cpp})
target_link_libraries(${stem} PUBLIC Boost::openmethod Boost::unit_test_framework)
target_link_libraries(${stem} PRIVATE Boost::openmethod Boost::unit_test_framework)
add_test(NAME ${stem} COMMAND ${stem})
add_dependencies(tests ${stem})
endforeach()
Expand All @@ -40,8 +39,8 @@ function(add_step_by_step dir)
file(GLOB cpp_files "${subdir}/*.cpp")
set(target "${dir}_${subex}")
add_executable(${target} ${cpp_files})
target_link_libraries(${target} PUBLIC Boost::openmethod)
set(output_dir "${subdir}")
target_link_libraries(${target} PRIVATE Boost::openmethod)
set(output_dir openmethod/${dir}/${subex})
set_target_properties(${target} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${output_dir}"
LIBRARY_OUTPUT_DIRECTORY "${output_dir}"
Expand Down
6 changes: 3 additions & 3 deletions doc/modules/ROOT/examples/shared_libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)

message(STATUS "Building shared library examples")
message(STATUS "Boost.OpenMethod: building shared library examples")

add_compile_definitions(BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS)

Expand Down Expand Up @@ -35,14 +35,14 @@ endif()
add_library(indirect_shared SHARED indirect_extensions.cpp)
target_compile_definitions(
indirect_shared PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
target_link_libraries(indirect_shared Boost::openmethod Boost::dll)
target_link_libraries(indirect_shared PRIVATE Boost::openmethod Boost::dll)
set_target_properties(indirect_shared PROPERTIES ENABLE_EXPORTS ON)

add_executable(indirect indirect_main.cpp)
target_compile_definitions(
indirect PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
set_target_properties(indirect PROPERTIES ENABLE_EXPORTS ON)
target_link_libraries(indirect Boost::openmethod Boost::dll)
target_link_libraries(indirect PRIVATE Boost::openmethod Boost::dll)
add_dependencies(indirect indirect_shared)
if (NOT WIN32)
add_test(NAME indirect_shared COMMAND indirect)
Expand Down
13 changes: 6 additions & 7 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Official repository: https://github.com/boostorg/openmethod
#

message(STATUS "Building tests")
message(STATUS "Boost.OpenMethod: building tests")

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS)
Expand Down Expand Up @@ -56,16 +56,15 @@ endif()
file(GLOB test_cpp_files "test_*.cpp")

foreach(test_cpp ${test_cpp_files})
cmake_path(REMOVE_EXTENSION test_cpp LAST_ONLY OUTPUT_VARIABLE test)
string(REGEX REPLACE ".*/" "" test ${test})
add_executable(${test} ${test_cpp})
target_link_libraries(${test} PUBLIC Boost::openmethod Boost::unit_test_framework)
get_filename_component(test ${test_cpp} NAME_WE)
add_executable(${test} EXCLUDE_FROM_ALL ${test_cpp})
target_link_libraries(${test} PRIVATE Boost::openmethod Boost::unit_test_framework)
add_test(NAME ${test} COMMAND ${test})
add_dependencies(tests ${test})
endforeach()

add_executable(test_mix_release_debug mix_release_debug/main.cpp mix_release_debug/lib.cpp)
target_link_libraries(test_mix_release_debug Boost::openmethod Boost::unit_test_framework)
add_executable(test_mix_release_debug EXCLUDE_FROM_ALL mix_release_debug/main.cpp mix_release_debug/lib.cpp)
target_link_libraries(test_mix_release_debug PRIVATE Boost::openmethod Boost::unit_test_framework)
add_test(NAME test_mix_release_debug COMMAND test_mix_release_debug)
add_dependencies(tests test_mix_release_debug)

Expand Down
Loading