From: TimePath Date: Mon, 31 Jul 2017 11:57:39 +0000 (+1000) Subject: CMake: Make dll bundling optional X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=826fce3cdc0bce78d15c04a2eb0a373dc1b251a3;p=xonotic%2Fnetradiant.git CMake: Make dll bundling optional --- 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"