option(BUNDLE_LIBRARIES "Bundle libraries" ${BUNDLE_LIBRARIES_DEFAULT})
+ if (BUNDLE_LIBRARIES)
+ add_subdirectory(bundle)
+ endif ()
+
macro (copy_dlls target)
- if (BUNDLE_LIBRARIES AND WIN32)
+ if (BUNDLE_LIBRARIES)
add_custom_command(TARGET ${target} POST_BUILD
- COMMAND bash
- ARGS -c "ldd '$<TARGET_FILE:${target}>' | egrep -i '\\.dll ' | grep -iv '/c/Windows' | awk '{ print $1 }' | while read dll; do dllbasename=\"$(which \"$dll\")\"; [ -f \"${PROJECT_BINARY_DIR}/$dllbasename\" ] || cp --preserve=timestamps \"$dllbasename\" '${PROJECT_BINARY_DIR}'; done"
+ COMMAND "${PROJECT_SOURCE_DIR}/library-bundler"
+ "register" "${PROJECT_BINARY_DIR}" "$<TARGET_FILE:${target}>"
VERBATIM
- )
- endif ()
- endmacro ()
-
- macro (bundle_stuff target)
- if (BUNDLE_LIBRARIES AND WIN32)
- add_custom_command(TARGET ${target} POST_BUILD
- COMMAND bash
- ARGS -c "mkdir -p '${PROJECT_BINARY_DIR}/share/themes'; mkdir -p '${PROJECT_BINARY_DIR}/lib'; mingw=\"$(echo '${CMAKE_C_COMPILER}' | sed -e 's|/bin/.*||')\"; [ -d '${PROJECT_BINARY_DIR}/share/themes/MS-Windows' ] || cp -r --preserve=timestamps \"$mingw/share/themes/MS-Windows\" '${PROJECT_BINARY_DIR}/share/themes/'; [ -d '${PROJECT_BINARY_DIR}/lib/gdk-pixbuf-2.0' ] || cp -r --preserve=timestamps \"$mingw/lib/gdk-pixbuf-2.0\" '${PROJECT_BINARY_DIR}/lib/'; [ -d '${PROJECT_BINARY_DIR}/lib/gtk-2.0' ] || cp -r --preserve=timestamps \"$mingw/lib/gtk-2.0\" '${PROJECT_BINARY_DIR}/lib/'"
- VERBATIM
- )
-
- file(GLOB DLL_FILES ${PROJECT_BINARY_DIR}/*.dll)
-
- install(FILES
- ${DLL_FILES}
- DESTINATION ${CMAKE_INSTALL_PREFIX}
- )
-
- install(DIRECTORY
- ${PROJECT_BINARY_DIR}/lib
- ${PROJECT_BINARY_DIR}/share
- DESTINATION ${CMAKE_INSTALL_PREFIX}
- )
+ )
+ add_dependencies(bundle ${target})
endif ()
endmacro ()
endif ()
endif ()
macro (radiant_tool name)
- add_executable(${name} ${ARGN})
+ if (BUNDLE_LIBRARIES AND WIN32)
+ add_executable(${name} ${ARGN} ${PROJECT_SOURCE_DIR}/include/lib.rc)
+ else ()
+ add_executable(${name} ${ARGN})
+ endif ()
copy_dlls(${name})