Skip to content

Commit 15fb7b7

Browse files
committed
Add CMake installation target
1 parent be4a3f9 commit 15fb7b7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ option( STRINGVIEW_LITE_OPT_SELECT_NONSTDSV "Select nonstd::string_view" OFF )
2020
option( STRINGVIEW_LITE_OPT_CONV_STD_STRING_CLASS_METHODS "Provide conversion to/from std::string (class methods)" ON )
2121
option( STRINGVIEW_LITE_OPT_CONV_STD_STRING_FREE_FUNCTIONS "Provide conversion to/from std::string (free functions)" ON )
2222

23-
include( GNUInstallDirs )
24-
2523
project( string_view_lite LANGUAGES CXX )
2624

25+
include( GNUInstallDirs )
26+
2727
set( package_name "string-view-lite" )
2828
set( include_source_dir "${PROJECT_SOURCE_DIR}/include" )
2929

@@ -35,6 +35,13 @@ add_library(
3535
target_include_directories(
3636
${package_name} INTERFACE "$<BUILD_INTERFACE:${include_source_dir}>" )
3737

38+
# Installation:
39+
40+
install(
41+
DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
42+
43+
# If requested, build and perform tests, build examples:
44+
3845
enable_testing()
3946

4047
if ( STRINGVIEW_LITE_OPT_BUILD_TESTS )
@@ -45,6 +52,4 @@ if ( STRINGVIEW_LITE_OPT_BUILD_EXAMPLES )
4552
add_subdirectory( example )
4653
endif()
4754

48-
install( DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
49-
5055
# end of file

0 commit comments

Comments
 (0)