11# only fetch target repo for add_subdirectory later
22function (fetch_repo lib_name)
33 set (supported_libs
4+ kvspic
45 kvscproducer)
56 list (FIND supported_libs ${lib_name} index)
67 if (${index} EQUAL -1)
78 message (WARNING "${lib_name} is not supported for fetch_repo" )
89 return ()
910 endif ()
1011
12+ if (WIN32 OR NOT PARALLEL_BUILD)
13+ set (PARALLEL_BUILD "" ) # No parallel build for Windows
14+ else ()
15+ set (PARALLEL_BUILD "--parallel" ) # Enable parallel builds for Unix-like systems
16+ endif ()
17+
1118 # build library
1219 configure_file (
1320 ./CMake/Dependencies/lib${lib_name} -CMakeLists.txt
@@ -21,7 +28,7 @@ function(fetch_repo lib_name)
2128 message (FATAL_ERROR "CMake step for lib${lib_name} failed: ${result} " )
2229 endif ()
2330 execute_process (
24- COMMAND ${CMAKE_COMMAND} --build .
31+ COMMAND ${CMAKE_COMMAND} --build . ${PARALLEL_BUILD}
2532 RESULT_VARIABLE result
2633 WORKING_DIRECTORY ${DEPENDENCY_DOWNLOAD_PATH} /lib${lib_name} )
2734 if (result)
@@ -34,6 +41,7 @@ function(build_dependency lib_name)
3441 set (supported_libs
3542 autoconf
3643 automake
44+ kvspic
3745 log4cplus)
3846 list (FIND supported_libs ${lib_name} index)
3947 if (${index} EQUAL -1)
@@ -73,6 +81,12 @@ function(build_dependency lib_name)
7381
7482 file (REMOVE_RECURSE ${KINESIS_VIDEO_OPEN_SOURCE_SRC} /lib${lib_name} )
7583
84+ if (WIN32 OR NOT PARALLEL_BUILD)
85+ set (PARALLEL_BUILD "" ) # No parallel build for Windows
86+ else ()
87+ set (PARALLEL_BUILD "--parallel" ) # Enable parallel builds for Unix-like systems
88+ endif ()
89+
7690 # build library
7791 configure_file (
7892 ${CMAKE_CURRENT_SOURCE_DIR} /CMake/Dependencies/lib${lib_name} -CMakeLists.txt
@@ -87,7 +101,7 @@ function(build_dependency lib_name)
87101 message (FATAL_ERROR "CMake step for lib${lib_name} failed: ${result} " )
88102 endif ()
89103 execute_process (
90- COMMAND ${CMAKE_COMMAND} --build .
104+ COMMAND ${CMAKE_COMMAND} --build . ${PARALLEL_BUILD}
91105 RESULT_VARIABLE result
92106 WORKING_DIRECTORY ${KINESIS_VIDEO_OPEN_SOURCE_SRC} /lib${lib_name} )
93107 if (result)
0 commit comments