-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
32 lines (26 loc) · 1.37 KB
/
CMakeLists.txt
File metadata and controls
32 lines (26 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
cmake_minimum_required(VERSION 3.10)
project(painful-cpp-string-conversion VERSION 5.0.0 DESCRIPTION "Why the conversion between C++ string/wstring/u8string/u16string/u32string so painful?" LANGUAGES CXX)
option(PAINFUL_CPP_STRING_CONVERSION_ENABLE_TEST "Enable test" OFF)
set(LIB_NAME painful-cpp-string-conversion)
add_library(${LIB_NAME} INTERFACE)
target_include_directories(${LIB_NAME} INTERFACE include)
if (PAINFUL_CPP_STRING_CONVERSION_ENABLE_TEST)
include(cmake/simdutf.cmake)
include(CTest)
set(TEST_CXX_STANDARDS cxx_std_17 cxx_std_20 cxx_std_23)
foreach(cxx_std IN ITEMS ${TEST_CXX_STANDARDS})
set(TEST_NAME "painful-cpp-string-conversion-test-${cxx_std}")
add_executable(${TEST_NAME})
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(${TEST_NAME} PRIVATE "/utf-8" "/sdl" "/W4")
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${TEST_NAME} PRIVATE "-Wall" "-Wextra")
set_target_properties(${TEST_NAME} PROPERTIES CXX_EXTENSIONS OFF)
endif ()
target_compile_features(${TEST_NAME} PRIVATE ${cxx_std})
target_sources(${TEST_NAME} PRIVATE test/test.cpp)
target_link_libraries(${TEST_NAME} PRIVATE ${LIB_NAME} simdutf)
add_test(NAME ${TEST_NAME} COMMAND $<TARGET_FILE:${TEST_NAME}>)
endforeach()
endif ()