blob: e9d40971b08d2c0394bbb35085445c679c833d05 (
plain)
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
|
# cmd/srv9p/CMakeLists.txt - Build script for srv9p test/dev executable
#
# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-Licence-Identifier: AGPL-3.0-or-later
set(static_srcs
static/README.md
static/Documentation/x
)
add_executable(srv9p
main.c
static9p.c
)
target_include_directories(srv9p PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(srv9p PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config)
target_link_libraries(srv9p
libcr
libcr_ipc
libnetio
lib9p
)
set(static_objs)
foreach(static_src ${static_srcs})
add_custom_command(
OUTPUT "${static_src}.obj"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND dirname -- ${CMAKE_CURRENT_BINARY_DIR}/${static_src}.obj | xargs mkdir -p --
COMMAND ${CMAKE_LINKER} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/${static_src}.obj ${static_src}
DEPENDS "${static_src}"
)
list(APPEND static_objs "${static_src}.obj")
endforeach()
set_source_files_properties(${static_objs} PROPERTIES
EXTERNAL_OBJECT true
GENERATED true
)
set_source_files_properties(static.h PROPERTIES
GENERATED true
)
add_custom_command(
OUTPUT static.h
DEPENDS ${static_objs} static.h.gen
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/static.h.gen ${static_objs} >static.h
)
target_sources(srv9p PRIVATE ${static_objs} static.h)
|