From 826fce3cdc0bce78d15c04a2eb0a373dc1b251a3 Mon Sep 17 00:00:00 2001 From: TimePath Date: Mon, 31 Jul 2017 21:57:39 +1000 Subject: [PATCH] CMake: Make dll bundling optional --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 335c1082..928461de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,8 +115,15 @@ endif () include_directories("${PROJECT_SOURCE_DIR}/include") include_directories("${PROJECT_SOURCE_DIR}/libs") +if (WIN32 AND NOT CMAKE_CROSSCOMPILING) + set(BUNDLE_LIBRARIES_DEFAULT ON) +else () + set(BUNDLE_LIBRARIES_DEFAULT OFF) +endif () +option(BUNDLE_LIBRARIES "Bundle libraries" ${BUNDLE_LIBRARIES_DEFAULT}) + macro(copy_dlls target) - if (WIN32) + if (BUNDLE_LIBRARIES) add_custom_command(TARGET ${target} POST_BUILD COMMAND bash ARGS -c "ldd '$' | grep -v /c/Windows | awk '{ print $1 }' | while read dll; do cp \"$(which $dll)\" '${PROJECT_BINARY_DIR}'; done" -- 2.39.2