forked from boostorg/regex
[CMake] Add option to build some of the examples
This commit is contained in:
@ -1,19 +1,23 @@
|
|||||||
# Copyright 2018 Mike Dev
|
# Copyright 2018-2019 Mike Dev
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
# 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
|
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
#
|
||||||
|
# NOTE: CMake support for Boost.Regex is currently experimental at best
|
||||||
|
# and the interface is likely to change in the future
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required( VERSION 3.5 )
|
||||||
project(BoostRegex LANGUAGES CXX)
|
project( BoostRegex LANGUAGES CXX )
|
||||||
|
|
||||||
|
option( BOOST_REGEX_INCLUDE_EXAMPLES "Also build (some) boost regex examples" OFF )
|
||||||
|
|
||||||
file(GLOB BOOST_REGEX_SRC ./src/*.cpp)
|
file( GLOB BOOST_REGEX_SRC ./src/*.cpp )
|
||||||
|
|
||||||
add_library(boost_regex ${BOOST_REGEX_SRC})
|
add_library( boost_regex ${BOOST_REGEX_SRC} )
|
||||||
add_library(Boost::regex ALIAS boost_regex)
|
add_library( Boost::regex ALIAS boost_regex )
|
||||||
|
|
||||||
target_include_directories(boost_regex PUBLIC include)
|
target_include_directories( boost_regex PUBLIC include )
|
||||||
|
|
||||||
target_link_libraries(boost_regex
|
target_link_libraries( boost_regex
|
||||||
PUBLIC
|
PUBLIC
|
||||||
Boost::assert
|
Boost::assert
|
||||||
Boost::concept_check
|
Boost::concept_check
|
||||||
@ -29,3 +33,8 @@ target_link_libraries(boost_regex
|
|||||||
Boost::throw_exception
|
Boost::throw_exception
|
||||||
Boost::type_traits
|
Boost::type_traits
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if( BOOST_REGEX_INCLUDE_EXAMPLES )
|
||||||
|
add_subdirectory( example/snippets )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
30
example/snippets/CMakeLists.txt
Normal file
30
example/snippets/CMakeLists.txt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Copyright 2019 Mike Dev
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
#
|
||||||
|
# NOTE: CMake support for Boost.Regex is currently experimental at best
|
||||||
|
# and we are currently only building a few examples
|
||||||
|
|
||||||
|
set(examples
|
||||||
|
partial_regex_grep
|
||||||
|
partial_regex_iterate
|
||||||
|
partial_regex_match
|
||||||
|
regex_grep_example_1
|
||||||
|
regex_grep_example_2
|
||||||
|
regex_grep_example_3
|
||||||
|
regex_grep_example_4
|
||||||
|
regex_iterator_example
|
||||||
|
regex_match_example
|
||||||
|
regex_merge_example
|
||||||
|
regex_replace_example
|
||||||
|
regex_search_example
|
||||||
|
regex_split_example_1
|
||||||
|
regex_split_example_2
|
||||||
|
regex_token_iterator_eg_1
|
||||||
|
regex_token_iterator_eg_2
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach( example IN LISTS examples )
|
||||||
|
add_executable( boost_regex_ex_${example} ${example}.cpp )
|
||||||
|
target_link_libraries( boost_regex_ex_${example} Boost::regex )
|
||||||
|
endforeach()
|
Reference in New Issue
Block a user