@@ -63,6 +63,7 @@ option(OPT_BUILD_SCHEDULER "Build the scheduler" OFF)
63
63
# Other options
64
64
option (USE_INTERNAL_LIBCORRECT "Use an internal version of libcorrect" ON )
65
65
option (USE_BUNDLE_DEFAULTS "Set the default resource and module directories to the right ones for a MacOS .app" OFF )
66
+ option (COPY_MSVC_REDISTRIBUTABLES "Copy over the Visual C++ Redistributable" OFF )
66
67
67
68
# Module cmake path
68
69
set (SDRPP_MODULE_CMAKE "${CMAKE_SOURCE_DIR} /sdrpp_module.cmake" )
@@ -314,9 +315,23 @@ target_compile_options(min_broken PRIVATE ${SDRPP_COMPILER_FLAGS})
314
315
if (MSVC )
315
316
add_custom_target (do_always ALL xcopy /s \"$<TARGET_FILE_DIR:sdrpp_core>\\ *.dll\" \" $<TARGET_FILE_DIR:sdrpp>\" /Y)
316
317
add_custom_target(do_always_volk ALL xcopy /s \" C:/Program Files/PothosSDR/bin\\ volk.dll\" \" $<TARGET_FILE_DIR:sdrpp>\" /Y)
318
+
319
+ if (COPY_MSVC_REDISTRIBUTABLES)
320
+ # Get the list of Visual C++ runtime DLLs
321
+ set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP True)
322
+ include(InstallRequiredSystemLibraries)
323
+
324
+ # Create a space sperated list
325
+ set(REDIST_DLLS_STR "")
326
+ foreach(DLL IN LISTS CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
327
+ set(REDIST_DLLS_STR COMMAND xcopy /F \" ${DLL} \" \" $<TARGET_FILE_DIR:sdrpp>\" /Y ${REDIST_DLLS_STR} )
328
+ endforeach()
329
+
330
+ # Create target
331
+ add_custom_target(do_always_msvc ALL ${REDIST_DLLS_STR} )
332
+ endif ()
317
333
endif ()
318
334
319
-
320
335
if (${CMAKE_SYSTEM_NAME} MATCHES " OpenBSD ")
321
336
add_custom_target(do_always ALL cp \" $<TARGET_FILE_DIR:sdrpp_core>/libsdrpp_core.so\" \" $<TARGET_FILE_DIR:sdrpp>\" )
322
337
endif ()
@@ -354,6 +369,4 @@ endif ()
354
369
355
370
# Create uninstall target
356
371
configure_file(${CMAKE_SOURCE_DIR} /cmake_uninstall.cmake ${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake @ONLY)
357
- add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake)
358
-
359
- # Create headers target
372
+ add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake)
0 commit comments