File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ endfunction()
2727# @param NAMESPACE
2828# @param HEADERS
2929# @param SOURCES
30+ # @param DEPENDS
3031# @parms TESTS_SOURCES
3132# @param [LIB_BUILD_INTERFACE="${PROJECT_SOURCE_DIR}/src"] The list of include paths for building
3233# the library and for external projects that link against it via the add_subdirectory() function.
@@ -39,6 +40,7 @@ function(cpp_library)
3940 set (multiValueArgs
4041 HEADERS
4142 SOURCES
43+ DEPENDS
4244 TESTS_SOURCES
4345 LIB_BUILD_INTERFACE
4446 )
@@ -56,7 +58,6 @@ function(cpp_library)
5658
5759 check_if_header_only_library(arg_cpp_lib_SOURCES _IS_INTERFACE_LIB)
5860
59- # Build interface library
6061 if (_IS_INTERFACE_LIB)
6162 add_library (${arg_cpp_lib_NAME} INTERFACE )
6263 target_include_directories (
@@ -66,7 +67,7 @@ function(cpp_library)
6667 )
6768 target_compile_features (${arg_cpp_lib_NAME} INTERFACE cxx_std_20)
6869 else ()
69- add_library (${arg_cpp_lib_NAME} STATIC )
70+ add_library (${arg_cpp_lib_NAME} "" ) # Library type determined by BUILD_SHARED_LIBS
7071 target_sources (
7172 ${arg_cpp_lib_NAME}
7273 PRIVATE
@@ -81,6 +82,7 @@ function(cpp_library)
8182 target_compile_features (${arg_cpp_lib_NAME} PUBLIC cxx_std_20)
8283 endif ()
8384
85+ target_link_libraries (${arg_cpp_lib_NAME} PUBLIC ${arg_cpp_lib_DEPENDS} )
8486 add_library (${arg_cpp_lib_NAMESPACE} ::${arg_cpp_lib_NAME} ALIAS ${arg_cpp_lib_NAME} )
8587
8688 if (YSTDLIB_CPP_ENABLE_TESTS)
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ if(YSTDLIB_CPP_IS_TOP_LEVEL)
4343 include (CTest)
4444endif ()
4545
46+ option (BUILD_SHARED_LIBS "Build using shared libraries." OFF )
47+
4648option (YSTDLIB_CPP_BUILD_TESTING "Build the testing tree for ystdlib-cpp." ON )
4749if (BUILD_TESTING AND YSTDLIB_CPP_BUILD_TESTING)
4850 set (YSTDLIB_CPP_ENABLE_TESTS ON )
You can’t perform that action at this time.
0 commit comments