Skip to content

Commit 352040a

Browse files
committed
Address coderabbitai concerns
1 parent 8015150 commit 352040a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

CMake/ystdlib-cpp-helpers.cmake

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ endfunction()
2828
# @param HEADERS
2929
# @param SOURCES
3030
# @param DEPENDS
31+
# @param PRIVATE_DEPENDS
3132
# @parms TESTS_SOURCES
3233
# @param [LIB_BUILD_INTERFACE="${PROJECT_SOURCE_DIR}/src"] The list of include paths for building
3334
# the library and for external projects that link against it via the add_subdirectory() function.
@@ -41,6 +42,7 @@ function(cpp_library)
4142
HEADERS
4243
SOURCES
4344
DEPENDS
45+
PRIVATE_DEPENDS
4446
TESTS_SOURCES
4547
LIB_BUILD_INTERFACE
4648
)
@@ -67,7 +69,8 @@ function(cpp_library)
6769
)
6870
target_compile_features(${arg_cpp_lib_NAME} INTERFACE cxx_std_20)
6971
else()
70-
add_library(${arg_cpp_lib_NAME} "") # Library type determined by BUILD_SHARED_LIBS
72+
# Empty string makes library type determined by `BUILD_SHARED_LIBS` option
73+
add_library(${arg_cpp_lib_NAME} "")
7174
target_sources(
7275
${arg_cpp_lib_NAME}
7376
PRIVATE
@@ -82,7 +85,13 @@ function(cpp_library)
8285
target_compile_features(${arg_cpp_lib_NAME} PUBLIC cxx_std_20)
8386
endif()
8487

85-
target_link_libraries(${arg_cpp_lib_NAME} PUBLIC ${arg_cpp_lib_DEPENDS})
88+
target_link_libraries(
89+
${arg_cpp_lib_NAME}
90+
PUBLIC
91+
${arg_cpp_lib_DEPENDS}
92+
PRIVATE
93+
${arg_cpp_lib_PRIVATE_DEPENDS}
94+
)
8695
add_library(${arg_cpp_lib_NAMESPACE}::${arg_cpp_lib_NAME} ALIAS ${arg_cpp_lib_NAME})
8796

8897
if(YSTDLIB_CPP_ENABLE_TESTS)

0 commit comments

Comments
 (0)