-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
68 lines (55 loc) · 1.67 KB
/
Copy pathCMakeLists.txt
File metadata and controls
68 lines (55 loc) · 1.67 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
cmake_minimum_required(VERSION 4.0)
project(unicode
VERSION "1.0"
DESCRIPTION "A Unicode/UTF-8 processing library"
HOMEPAGE_URL "https://github.com/printfdebugging/unicode"
LANGUAGES "C"
)
include(GNUInstallDirs)
set(CMAKE_C_STANDARD 23)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(UNICODE_LIB_NAME unicode)
add_compile_options(-std=gnu2x)
add_library(unicode
source/unicode.c
)
target_include_directories(unicode
PUBLIC include
)
target_compile_options(unicode
PRIVATE -fPIC
)
install(
DIRECTORY include/unicode
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
TARGETS unicode
EXPORT unicode
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/unicode.pc.in
${CMAKE_CURRENT_BINARY_DIR}/unicode.pc @ONLY
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/unicode.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
# source: https://github.com/nitrix/nui/blob/master/CMakeLists.txt
enable_testing()
file(GLOB testfiles_fullpath "${CMAKE_CURRENT_SOURCE_DIR}/tests/*.c")
SET(testfiles_relative)
foreach(name ${testfiles_fullpath})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/tests/" "" name ${name})
SET(testfiles_relative ${testfiles_relative} ${name})
endforeach()
create_test_sourcelist(testlist test_runner.c ${testfiles_relative})
add_executable(test_runner test_runner.c ${testfiles_fullpath})
target_link_libraries(test_runner unicode)
foreach(name ${testfiles_relative})
string(REPLACE ".c" "" name ${name})
add_test(NAME ${name} COMMAND test_runner ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)
endforeach()