]> git.lyx.org Git - lyx.git/blob - development/cmake/Install.cmake
61c6213d54684e420b1fe9a83435d8be8a4e1d70
[lyx.git] / development / cmake / Install.cmake
1
2 # TODO: set correct path in call to cmake
3 # e.g. cmake /usr/src/lyx/lyx-devel/development/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/share/lyx2.0 -Dnls=1
4
5 message(STATUS "installing to ${CMAKE_INSTALL_PREFIX}, defined by CMAKE_INSTALL_PREFIX")
6
7 # the macro scans the directories "_parent_src_dir/_dir/_current_dir" for *._file_type files
8 # and installs the files in CMAKE_INSTALL_PREFIX/_current_dir
9 # dir_item is on item of the remaining arguments
10 macro(lyx_install _parent_src_dir _gl_dir _file_type)
11   file(GLOB _dirs RELATIVE "${_parent_src_dir}" ${_parent_src_dir}/${_gl_dir})
12   #cmake bug on Windows: if _gl_dir==. _dirs is empty but on linux _dirs==.
13   if(NOT _dirs)
14     set(_dirs .)
15   endif() 
16   foreach(_dir ${_dirs})
17     foreach(_glob_dir ${ARGN})
18       file(GLOB _dir_list ${_parent_src_dir}/${_dir}/${_glob_dir})
19       if(NOT _dir_list)
20         set(_dir_list ${_parent_src_dir}/${_dir})
21       endif() 
22       if(_glob_dir STREQUAL ".")
23         set(_dir_list ${_parent_src_dir}/${_dir}/.)
24       endif()
25       #message(STATUS "${_dir}/${_glob_dir} -> ${_dir_list} ")
26       foreach(_current_dir ${_dir_list})
27         file(GLOB _item_list ${_current_dir}/${_file_type})
28         #cmake bug: globbing with * also returns directories on Windows
29         set(files_list ${_item_list})
30         foreach(_current_item ${_item_list})
31           if(IS_DIRECTORY ${_current_item})
32             #message(STATUS "removing ${_current_item}")
33             if(files_list)
34               list(REMOVE_ITEM files_list "${_current_item}")
35             endif()
36           endif()
37         endforeach(_current_item)
38         if(files_list)
39           list(REMOVE_ITEM files_list "${_current_dir}/.svn")
40           list(REMOVE_ITEM files_list "${_current_dir}/Makefile.in")
41           list(REMOVE_ITEM files_list "${_current_dir}/Makefile.am")
42           GET_FILENAME_COMPONENT(_base_dir ${_current_dir} NAME)
43           if(_glob_dir STREQUAL ".")
44             set(_base_dir .)
45           endif()
46           #message(STATUS "install ${_dir}/${_base_dir}: ${files_list} ")
47           #message(STATUS "install at ${CMAKE_INSTALL_PREFIX}/${_dir}/${_base_dir}")
48           install(FILES ${files_list} DESTINATION ${_dir}/${_base_dir})
49         endif()
50       endforeach(_current_dir)
51     endforeach(_glob_dir)
52   endforeach(_dir)
53 endmacro(lyx_install)
54
55
56 # language-specific-directories (like ca, de, es ...) are now globbed as "[a-z][a-z]"
57 set(_all_languages "[a-z][a-z]")
58
59 lyx_install(${TOP_SRC_DIR}/lib bind         *.bind   . ${_all_languages})
60 lyx_install(${TOP_SRC_DIR}/lib commands     *.def    .)
61
62 # this is handled in doc/CMakeLists.txt
63 #lyx_install(${TOP_SRC_DIR}/lib doc          *.lyx    . ${_all_languages})
64 #lyx_install(${TOP_SRC_DIR}/lib doc          *.txt    . ${_all_languages})
65 lyx_install(${TOP_SRC_DIR}/lib doc          *      biblio clipart)
66
67 lyx_install(${TOP_SRC_DIR}/lib doc/${_all_languages} *    clipart)
68
69 lyx_install(${TOP_SRC_DIR}/lib examples     *      . ${_all_languages})
70 lyx_install(${TOP_SRC_DIR}/lib fonts        *      .)
71 lyx_install(${TOP_SRC_DIR}/lib images       *      . math commands attic)
72 lyx_install(${TOP_SRC_DIR}/lib kbd          *      .)
73 lyx_install(${TOP_SRC_DIR}/lib layouts      *      .)
74 lyx_install(${TOP_SRC_DIR}/lib lyx2lyx      *.py   .)
75 lyx_install(${TOP_SRC_DIR}/lib scripts      *.py   .)
76 lyx_install(${TOP_SRC_DIR}/lib templates    *      .)
77 lyx_install(${TOP_SRC_DIR}/lib tex          *      .)
78 lyx_install(${TOP_SRC_DIR}/lib ui           *      .)
79 lyx_install(${TOP_SRC_DIR}/lib .            *      .)
80
81 install(PROGRAMS ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx DESTINATION lyx2lyx)
82