File tree Expand file tree Collapse file tree 5 files changed +30
-6
lines changed Expand file tree Collapse file tree 5 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "")
12
12
endif ()
13
13
14
14
# build version
15
- set (build_version 0.2 .0 )
15
+ set (build_version 0.3 .0 )
16
16
17
17
# project parameters
18
18
set (project_name forest )
@@ -63,6 +63,9 @@ target_include_directories(${PROJECT_NAME} INTERFACE
63
63
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} /include>"
64
64
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >"
65
65
)
66
+ source_group (TREE "${CMAKE_CURRENT_SOURCE_DIR} " FILES include /forest/forest.hpp )
67
+
68
+ configure_file (cmake/forest_version.hpp.in "${CMAKE_CURRENT_BINARY_DIR} /include/forest/forest_version.hpp" @ONLY )
66
69
67
70
# examples
68
71
if (FOREST_BUILD_EXAMPLE )
Original file line number Diff line number Diff line change
1
+ #include <string_view>
2
+
3
+ namespace forest {
4
+ inline constexpr std::string_view version_v = "@PROJECT_VERSION@";
5
+ }
Original file line number Diff line number Diff line change 1
- add_executable (forest-example )
2
- target_link_libraries (forest-example PRIVATE forest::forest )
3
- target_sources (forest-example PRIVATE forest-example.cpp )
1
+ cmake_minimum_required (VERSION 3.17 FATAL_ERROR )
2
+
3
+ project (forest-example )
4
+
5
+ if (NOT TARGET forest )
6
+ find_package (forest REQUIRED CONFIG )
7
+ endif ()
8
+
9
+ add_executable (${PROJECT_NAME} )
10
+ target_link_libraries (${PROJECT_NAME} PRIVATE forest::forest )
11
+ target_sources (${PROJECT_NAME} PRIVATE forest-example.cpp )
12
+ source_group (TREE "${CMAKE_CURRENT_SOURCE_DIR} " FILES forest-example.cpp )
4
13
5
14
if (CMAKE_CXX_COMPILER_ID MATCHES "^Clang$" OR CMAKE_CXX_COMPILER_ID MATCHES "^GNU$" )
6
- target_compile_options (forest-example PRIVATE -Wall -Wextra -Wpedantic )
15
+ target_compile_options (${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic )
7
16
endif ()
Original file line number Diff line number Diff line change @@ -5,5 +5,8 @@ constexpr auto foo = forest::literal<64>("<rgb=500><b><i>hello</b></i></rgb> wor
5
5
6
6
int main () {
7
7
std::cout << foo << ' \n ' ;
8
- forest::print (" <invert>forest</invert>\n " );
8
+ auto str = std::string (" <invert>forest</invert> <dim>v" );
9
+ str += forest::version_v;
10
+ str += " </dim>\n " ;
11
+ forest::print (str);
9
12
}
Original file line number Diff line number Diff line change 6
6
#include < iterator>
7
7
#include < string>
8
8
9
+ #if __has_include(<forest/forest_version.hpp>)
10
+ #include < forest/forest_version.hpp>
11
+ #endif
12
+
9
13
namespace forest {
10
14
// /
11
15
// / \brief Interpolate escape sequences through text and write characters to out
You can’t perform that action at this time.
0 commit comments