CMake: Make dll bundling optional
[xonotic/netradiant.git] / CMakeLists.txt
index 16124b7b29bda415c8e8fdf6c3d0bf9669e7290b..928461deec0b3468815218cf8a50a72e00b1ad88 100644 (file)
@@ -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 '$<TARGET_FILE:${target}>' | grep -v /c/Windows | awk '{ print $1 }' | while read dll; do cp \"$(which $dll)\" '${PROJECT_BINARY_DIR}'; done"
@@ -194,13 +201,11 @@ endif ()
 add_subdirectory(tools)
 
 file(GLOB DATA_FILES "${PROJECT_SOURCE_DIR}/setup/data/tools/*")
-file(GLOB DOCS_FILES "${PROJECT_SOURCE_DIR}/docs/*")
 
 if (NOT (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR))
     # Copy data files from sources to the build directory
     message(STATUS "Copying data files")
     file(COPY ${DATA_FILES} DESTINATION "${PROJECT_BINARY_DIR}")
-    file(COPY ${DOCS_FILES} DESTINATION "${PROJECT_BINARY_DIR}/docs")
 endif ()
 
 #-----------------------------------------------------------------------