-lyx_install(${TOP_SRC_DIR}/lib bind *.bind . [a-z][a-z])
-lyx_install(${TOP_SRC_DIR}/lib commands *.def .)
-# this is handled in doc/CMakefile.txt
-#lyx_install(${TOP_SRC_DIR}/lib doc *.lyx . [a-z][a-z])
-#lyx_install(${TOP_SRC_DIR}/lib doc *.txt . [a-z][a-z])
-lyx_install(${TOP_SRC_DIR}/lib doc * biblio clipart)
-lyx_install(${TOP_SRC_DIR}/lib doc/de * clipart)
-lyx_install(${TOP_SRC_DIR}/lib doc/es * clipart)
-lyx_install(${TOP_SRC_DIR}/lib doc/fr * clipart)
-lyx_install(${TOP_SRC_DIR}/lib doc/it * clipart)
-lyx_install(${TOP_SRC_DIR}/lib doc/ja * clipart)
-lyx_install(${TOP_SRC_DIR}/lib doc/uk * clipart)
-lyx_install(${TOP_SRC_DIR}/lib examples * . [a-z][a-z])
-lyx_install(${TOP_SRC_DIR}/lib fonts * .)
-lyx_install(${TOP_SRC_DIR}/lib images * . math commands attic)
-lyx_install(${TOP_SRC_DIR}/lib kbd * .)
-lyx_install(${TOP_SRC_DIR}/lib layouts * .)
-lyx_install(${TOP_SRC_DIR}/lib lyx2lyx * .)
-lyx_install(${TOP_SRC_DIR}/lib scripts * .)
-lyx_install(${TOP_SRC_DIR}/lib templates * .)
-lyx_install(${TOP_SRC_DIR}/lib tex * .)
-lyx_install(${TOP_SRC_DIR}/lib ui * .)
-lyx_install(${TOP_SRC_DIR}/lib . * .)
-
-install(PROGRAMS ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx DESTINATION lyx2lyx)
+# language-specific-directories (like ca, de, es ...) are now globbed as "[a-z][a-z]"
+set(_all_languages "[a-z][a-z]")
+
+lyx_install("data" ${TOP_SRC_DIR}/lib bind *.bind . ${_all_languages})
+lyx_install("data" ${TOP_SRC_DIR}/lib commands *.def .)
+
+# this is handled in doc/CMakeLists.txt
+#lyx_install("data" ${TOP_SRC_DIR}/lib doc *.lyx . ${_all_languages})
+#lyx_install("data" ${TOP_SRC_DIR}/lib doc *.txt . ${_all_languages})
+lyx_install("data" ${TOP_SRC_DIR}/lib doc * biblio clipart)
+
+lyx_install("data" ${TOP_SRC_DIR}/lib doc/${_all_languages} * clipart)
+
+lyx_install("data" ${TOP_SRC_DIR}/lib examples * . ${_all_languages} springer thesis)
+lyx_install("font" ${TOP_SRC_DIR}/lib/fonts . * .)
+foreach(_imgext "png" "svgz" "gif" "xpm")
+ lyx_install("data" ${TOP_SRC_DIR}/lib images "*.${_imgext}" . ipa commands attic classic oxygen)
+ lyx_install("data" ${TOP_SRC_DIR}/lib images/math "*.${_imgext}" . oxygen)
+endforeach()
+lyx_install("data" ${TOP_SRC_DIR}/lib kbd * .)
+lyx_install("data" ${TOP_SRC_DIR}/lib layouts * .)
+lyx_install("data" ${TOP_SRC_DIR}/lib lyx2lyx *.py .)
+lyx_install("data" ${TOP_SRC_DIR}/lib scripts *.py .)
+lyx_install("data" ${TOP_SRC_DIR}/lib citeengines *.citeengine .)
+lyx_install("data" ${TOP_SRC_DIR}/lib . *.py .)
+lyx_install("data" ${TOP_SRC_DIR}/lib scripts *.R .)
+lyx_install("data" ${TOP_SRC_DIR}/lib templates * . springer)
+lyx_install("data" ${TOP_SRC_DIR}/lib xtemplates *.xtemplate .)
+lyx_install("tex" ${TOP_SRC_DIR}/lib/tex . * .)
+lyx_install("data" ${TOP_SRC_DIR}/lib ui * .)
+lyx_install("data" ${TOP_SRC_DIR}/lib . * .)
+
+# Install
+if(APPLE)
+ if(LYX_BUNDLE)
+ install(FILES ${TOP_SRC_DIR}/development/MacOSX/spotlight/Info.plist DESTINATION "${MACOSX_BUNDLE_STARTUP_COMMAND}/Contents/Library/Spotlight/LyX-Metadata.mdimporter/Contents")
+ install(FILES "${TOP_SRC_DIR}/development/MacOSX/PkgInfo" DESTINATION "${MACOSX_BUNDLE_STARTUP_COMMAND}/Contents")
+ endif()
+
+ foreach(_i lyxeditor maxima inkscape)
+ install(FILES "${TOP_SRC_DIR}/development/MacOSX/${_i}" DESTINATION "${LYX_UTILITIES_INSTALL_PATH}")
+ endforeach()
+ install(FILES "${TOP_SRC_DIR}/development/MacOSX/LyX.icns" DESTINATION "${LYX_DATA_SUBDIR}")
+ set(program_suffix ${PROGRAM_SUFFIX})
+ configure_file("${TOP_SRC_DIR}/development/MacOSX/lyxrc.dist.in" lyxrc.dist)
+ lyx_install("data" ${CMAKE_CURRENT_BINARY_DIR} . lyxrc.dist .)
+elseif(UNIX)
+ set(program_suffix ${PROGRAM_SUFFIX})
+ configure_file(${TOP_SRC_DIR}/lib/lyx.desktop.in lyx${PROGRAM_SUFFIX}.desktop)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lyx${PROGRAM_SUFFIX}.desktop DESTINATION ${SYSTEM_DATADIR}/applications)
+ install(FILES ${TOP_SRC_DIR}/lib/images/lyx.svg RENAME lyx${PROGRAM_SUFFIX}.svg DESTINATION ${SYSTEM_DATADIR}/icons/hicolor/scalable/apps/)
+ configure_file(${TOP_SRC_DIR}/development/unix/lyxrc.dist.in lyxrc.dist)
+ lyx_install("data" ${CMAKE_CURRENT_BINARY_DIR} . lyxrc.dist .)
+endif()
+
+if(USE_POSIX_PACKAGING AND EXISTS "${TOP_SRC_DIR}/lib/usr.bin.lyxwrap.in")
+ # handle lyxwrap
+ #get_filename_component(prefix "${CMAKE_INSTALL_PREFIX}" REALPATH)
+ set(prefix "${CMAKE_INSTALL_PREFIX}")
+ set(version_suffix ${PROGRAM_SUFFIX})
+ string(REGEX REPLACE "^/" "" lyxwrapprefix1 "${prefix}")
+ string(REPLACE "/" "." lyxwrapprefix ${lyxwrapprefix1})
+ #message(STATUS "lyxwrapprefix = ${lyxwrapprefix}")
+ configure_file(${TOP_SRC_DIR}/lib/usr.bin.lyxwrap.in "${lyxwrapprefix}.${LYX_UTILITIES_INSTALL_PATH}.lyx${PROGRAM_SUFFIX}")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lyxwrapprefix}.${LYX_UTILITIES_INSTALL_PATH}.lyx${PROGRAM_SUFFIX}" DESTINATION /etc/apparmor.d/)
+endif()