Skip to content

Commit

Permalink
Boost super-project tests target
Browse files Browse the repository at this point in the history
fix #53
  • Loading branch information
alandefreitas committed Feb 20, 2024
1 parent 42bb99e commit bff5cb6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ endif ()
# Options
if (NOT BOOST_SUPERPROJECT_VERSION)
option(BOOST_STATIC_STRING_INSTALL "Install boost::static_string files" ${BOOST_STATIC_STRING_IS_ROOT})
option(BOOST_STATIC_STRING_BUILD_TESTS "Build boost::static_string tests" ${BUILD_TESTING})
option(BOOST_STATIC_STRING_BUILD_TESTS "Build boost::static_string tests" OFF)
else ()
set(BOOST_STATIC_STRING_BUILD_TESTS ${BUILD_TESTING})
endif ()
Expand Down Expand Up @@ -112,7 +112,7 @@ if (BOOST_STATIC_STRING_INSTALL AND NOT BOOST_SUPERPROJECT_VERSION)
endif ()


if (BOOST_STATIC_STRING_BUILD_TESTS)
if (BUILD_TESTING OR BOOST_STATIC_STRING_BUILD_TESTS)
add_subdirectory(test)
endif ()

1 change: 1 addition & 0 deletions meta/libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"String"
],
"maintainers": [
"Krystian Stasiowski <[email protected]>",
"Alan de Freitas <[email protected]>",
"Vinnie Falco <[email protected]>"
],
Expand Down
7 changes: 7 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
# Official repository: https://github.com/boostorg/static_string
#

# Custom target used by the boost super-project
if(NOT TARGET tests)
add_custom_target(tests)
set_property(TARGET tests PROPERTY FOLDER _deps)
endif()

set(BOOST_STATIC_STRING_TESTS_FILES
CMakeLists.txt
Jamfile
Expand All @@ -23,3 +29,4 @@ add_executable(boost_static_string_tests ${BOOST_STATIC_STRING_TESTS_FILES})
# See: BOOST_STATIC_STRING_UNIT_TEST_LIBRARIES
target_link_libraries(boost_static_string_tests PRIVATE Boost::static_string)
add_test(NAME boost_static_string_tests COMMAND boost_static_string_tests)
add_dependencies(tests boost_static_string_tests)

0 comments on commit bff5cb6

Please sign in to comment.