From 12d26f1c148cfff59bfbc2b87bb4ca779955e0e2 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 5 Feb 2026 17:57:19 +0200 Subject: [PATCH] Add test/cmake_subdir_test --- test/cmake_subdir_test/CMakeLists.txt | 18 ++++++++++++++++++ test/cmake_subdir_test/main.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 test/cmake_subdir_test/CMakeLists.txt create mode 100644 test/cmake_subdir_test/main.cpp diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt new file mode 100644 index 0000000..eb5d911 --- /dev/null +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright 2018, 2019 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 + +cmake_minimum_required(VERSION 3.5...3.31) + +project(cmake_subdir_test LANGUAGES CXX) + +set(BOOST_INCLUDE_LIBRARIES xpressive) +add_subdirectory(../../../.. boostorg/boost) + +add_executable(main main.cpp) +target_link_libraries(main Boost::xpressive) + +enable_testing() +add_test(main main) + +add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $) diff --git a/test/cmake_subdir_test/main.cpp b/test/cmake_subdir_test/main.cpp new file mode 100644 index 0000000..f9abd37 --- /dev/null +++ b/test/cmake_subdir_test/main.cpp @@ -0,0 +1,25 @@ +// Copyright 2026 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +using namespace boost::xpressive; + +int main() +{ + std::string hello( "hello world!" ); + + sregex rex = sregex::compile( "(\\w+) (\\w+)!" ); + smatch what; + + if( regex_match( hello, what, rex ) ) + { + return what.size() == 3? 0: 1; + } + else + { + return 2; + } +}