-
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
97 lines (89 loc) · 3.51 KB
/
CMakeLists.txt
File metadata and controls
97 lines (89 loc) · 3.51 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# =============================================================================
#
# ztd.text
# Copyright © JeanHeyd "ThePhD" Meneide and Shepherd's Oasis, LLC
# Contact: opensource@soasis.org
#
# Commercial License Usage
# Licensees holding valid commercial ztd.text licenses may use this file in
# accordance with the commercial license agreement provided with the
# Software or, alternatively, in accordance with the terms contained in
# a written agreement between you and Shepherd's Oasis, LLC.
# For licensing terms and conditions see your agreement. For
# further information contact opensource@soasis.org.
#
# Apache License Version 2 Usage
# Alternatively, this file may be used under the terms of Apache License
# Version 2.0 (the "License") for non-commercial use; you may not use this
# file except in compliance with the License. You may obtain a copy of the
# License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ============================================================================>
set(ztd-text-examples-data-source ${CMAKE_CURRENT_SOURCE_DIR}/data)
set(ztd-text-examples-data-destination ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/data)
file(GLOB_RECURSE ztd-text-examples-data-source-files
LIST_DIRECTORIES OFF
RELATIVE ${ztd-text-examples-data-source}
CONFIGURE_DEPENDS
./data/*.*
)
list(SUBLIST ztd-text-examples-data-source-files 0 -1 ztd-text-examples-data-destination-files)
list(TRANSFORM ztd-text-examples-data-source-files PREPEND "${ztd-text-examples-data-source}/")
list(TRANSFORM ztd-text-examples-data-destination-files PREPEND "${ztd-text-examples-data-destination}/")
add_custom_command(OUTPUT ${ztd-text-examples-data-destination-files}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${ztd-text-examples-data-source} ${ztd-text-examples-data-destination}
COMMENT "[ztd.text/examples] Copying data files from \"${ztd-text-examples-data-source}\" used in examples over to \"${ztd-text-examples-data-destination}\"..."
DEPENDS ${ztd-text-examples-data-source-files}
)
add_custom_target(ztd.text.examples.basic.data
DEPENDS ${ztd-text-examples-data-destination-files}
)
file(GLOB_RECURSE ztd.text.examples.basic.sources
LIST_DIRECTORIES OFF
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/source
CONFIGURE_DEPENDS
source/*.cpp
)
foreach (example_source_name ${ztd.text.examples.basic.sources})
set(example_source_file source/${example_source_name})
set(example_target ztd.text.examples.basic.${example_source_name})
add_executable(${example_target} ${example_source_file})
target_compile_options(${example_target}
PRIVATE
${--utf8-literal-encoding}
${--utf8-source-encoding}
${--disable-permissive}
${--warn-pedantic}
${--warn-all}
${--warn-extra}
${--warn-errors}
${--allow-alignas-extra-padding}
${--allow-stringop-overflow} ${--allow-stringop-overread}
${--allow-array-bounds}
${--allow-bit-int-extension}
)
target_link_libraries(${example_target}
PRIVATE
ztd::text
${CMAKE_DL_LIBS}
)
target_include_directories(${example_target}
PRIVATE
../include
)
add_dependencies(${example_target} ztd.text.examples.basic.data)
if (ZTD_TEXT_TESTS)
add_test(NAME ${example_target}
COMMAND ${example_target}
WORKING_DIRECTORY ${ztd-text-examples-data-destination}
)
endif()
endforeach()