Skip to content

Commit 1166ea4

Browse files
committed
refactor: replace with INTERFACE, DEFAULT_KERNEL_LINK_LIB
Signed-off-by: Zone.N <zone.niuzh@hotmail.com>
1 parent 1b2c862 commit 1166ea4

File tree

5 files changed

+5
-40
lines changed

5 files changed

+5
-40
lines changed

cmake/compile_config.cmake

+5-1
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,16 @@ target_link_options(DEFAULT_KERNEL_LINK_OPTIONS INTERFACE
192192

193193
add_library(DEFAULT_KERNEL_LINK_LIB INTERFACE)
194194
target_link_libraries(DEFAULT_KERNEL_LINK_LIB INTERFACE
195+
COMMON_COMPILE_OPTIONS
196+
COMMON_LINK_OPTIONS
195197
COMMON_LINK_LIB
198+
COMMON_DEFINITIONS
199+
DEFAULT_KERNEL_DEFINITIONS
200+
DEFAULT_KERNEL_COMPILE_OPTIONS
196201
DEFAULT_KERNEL_LINK_OPTIONS
197202

198203
printf_bare_metal
199204
dtc-lib
200-
COMMON_COMPILE_OPTIONS
201205

202206
$<$<STREQUAL:${CMAKE_SYSTEM_PROCESSOR},riscv64>:
203207
opensbi_interface

src/kernel/CMakeLists.txt

-15
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,6 @@ target_include_directories(kernel PRIVATE
2828
include
2929
)
3030

31-
# 添加定义
32-
target_compile_definitions(${PROJECT_NAME} PRIVATE
33-
${DEFAULT_KERNEL_DEFINITIONS}
34-
)
35-
36-
# 添加编译参数
37-
target_compile_options(${PROJECT_NAME} PRIVATE
38-
${DEFAULT_KERNEL_COMPILE_OPTIONS}
39-
)
40-
41-
# 添加链接参数
42-
target_link_options(${PROJECT_NAME} PRIVATE
43-
${DEFAULT_KERNEL_LINK_OPTIONS}
44-
)
45-
4631
# 添加要链接的库
4732
target_link_libraries(${PROJECT_NAME} PRIVATE
4833
DEFAULT_KERNEL_LINK_LIB

test/system_test/cxx_init_test/CMakeLists.txt

-8
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ target_include_directories(${PROJECT_NAME} PRIVATE
2727
${CMAKE_SOURCE_DIR}/src/kernel/arch/${CMAKE_SYSTEM_PROCESSOR}/include
2828
)
2929

30-
target_compile_options(${PROJECT_NAME} PRIVATE
31-
${DEFAULT_KERNEL_COMPILE_OPTIONS}
32-
)
33-
34-
target_link_options(${PROJECT_NAME} PRIVATE
35-
${DEFAULT_KERNEL_LINK_OPTIONS}
36-
)
37-
3830
target_link_libraries(${PROJECT_NAME} PRIVATE
3931
DEFAULT_KERNEL_LINK_LIB
4032
libc

test/system_test/gnu_efi_test/CMakeLists.txt

-8
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ target_include_directories(${PROJECT_NAME} PRIVATE
2222
${CMAKE_SOURCE_DIR}/src/kernel/arch/${CMAKE_SYSTEM_PROCESSOR}/include
2323
)
2424

25-
target_compile_options(${PROJECT_NAME} PRIVATE
26-
${DEFAULT_KERNEL_COMPILE_OPTIONS}
27-
)
28-
29-
target_link_options(${PROJECT_NAME} PRIVATE
30-
${DEFAULT_KERNEL_LINK_OPTIONS}
31-
)
32-
3325
target_link_libraries(${PROJECT_NAME} PRIVATE
3426
DEFAULT_KERNEL_LINK_LIB
3527
libc

test/system_test/opensbi_test/CMakeLists.txt

-8
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ add_executable(${PROJECT_NAME}
1818
${CMAKE_SOURCE_DIR}/src/kernel/arch/${CMAKE_SYSTEM_PROCESSOR}/boot.S
1919
)
2020

21-
target_compile_options(${PROJECT_NAME} PRIVATE
22-
${DEFAULT_KERNEL_COMPILE_OPTIONS}
23-
)
24-
25-
target_link_options(${PROJECT_NAME} PRIVATE
26-
${DEFAULT_KERNEL_LINK_OPTIONS}
27-
)
28-
2921
# 添加要链接的库
3022
target_link_libraries(${PROJECT_NAME} PRIVATE
3123
DEFAULT_KERNEL_LINK_LIB

0 commit comments

Comments
 (0)