Skip to content

Commit a82127a

Browse files
committed
cmake install
1 parent 53e4ec7 commit a82127a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

CMakeLists.txt

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ project(painful-cpp-string-conversion VERSION 2.0.0 DESCRIPTION "Why the convers
33

44
option(PAINFUL_CPP_STRING_CONVERSION_ENABLE_TEST "Enable test" OFF)
55

6-
add_library(painful-cpp-string-conversion INTERFACE)
7-
target_include_directories(painful-cpp-string-conversion INTERFACE include)
6+
set(LIB_NAME painful-cpp-string-conversion)
7+
set(TEST_NAME painful-cpp-string-conversion-test)
8+
9+
add_library(${LIB_NAME} INTERFACE)
10+
set_target_properties(${LIB_NAME} PROPERTIES PUBLIC_HEADER include/encoding/string.hpp)
11+
target_include_directories(${LIB_NAME} INTERFACE include)
812

913
if (PAINFUL_CPP_STRING_CONVERSION_ENABLE_TEST)
1014
add_library(simdutf STATIC)
@@ -15,12 +19,14 @@ if (PAINFUL_CPP_STRING_CONVERSION_ENABLE_TEST)
1519
target_include_directories(simdutf PUBLIC external/simdutf)
1620
target_sources(simdutf PRIVATE external/simdutf/simdutf.h external/simdutf/simdutf.cpp)
1721

18-
set(TEST_NAME painful-cpp-string-conversion-test)
1922
add_executable(${TEST_NAME})
2023
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
2124
target_compile_options(${TEST_NAME} PRIVATE "/utf-8")
2225
endif ()
2326
target_compile_features(${TEST_NAME} PRIVATE cxx_std_20)
2427
target_sources(${TEST_NAME} PRIVATE test/test_string.cpp)
25-
target_link_libraries(${TEST_NAME} PRIVATE painful-cpp-string-conversion simdutf)
28+
target_link_libraries(${TEST_NAME} PRIVATE ${LIB_NAME} simdutf)
2629
endif ()
30+
31+
include(GNUInstallDirs)
32+
install(TARGETS ${LIB_NAME} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/encoding)

0 commit comments

Comments
 (0)