]> git.lyx.org Git - features.git/blob - development/cmake/Install.cmake
cmake: more changes from Kornel, and Windows fixes: glob is not really cross plattform
[features.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   if(NOT _dirs)
13     set(_dirs .)
14   endif() 
15   foreach(_dir ${_dirs})
16     foreach(_glob_dir ${ARGN})
17       file(GLOB _dir_list ${_parent_src_dir}/${_dir}/${_glob_dir})
18       if(NOT _dir_list)
19         set(_dir_list ${_parent_src_dir}/${_dir})
20       endif() 
21       #message(STATUS "${_dir}/${_glob_dir} -> ${_dir_list} ")
22       foreach(_current_dir ${_dir_list})
23         file(GLOB _item_list ${_current_dir}/${_file_type})
24         set(files_list ${_item_list})
25         foreach(_current_item ${_item_list})
26           if(IS_DIRECTORY ${_current_item})
27             #message(STATUS "removing ${_current_item}")
28             if(files_list)
29               list(REMOVE_ITEM files_list "${_current_item}")
30             endif()
31           endif()
32         endforeach(_current_item)
33         if(files_list)
34           list(REMOVE_ITEM files_list "${_current_dir}/.svn")
35           list(REMOVE_ITEM files_list "${_current_dir}/Makefile.in")
36           list(REMOVE_ITEM files_list "${_current_dir}/Makefile.am")
37           GET_FILENAME_COMPONENT(_base_dir ${_current_dir} NAME)
38           if(_glob_dir STREQUAL ".")
39             set(_base_dir .)
40           endif()
41           #message(STATUS "install ${_dir}/${_base_dir}: ${files_list} ")
42           #message(STATUS "install at ${CMAKE_INSTALL_PREFIX}/${_dir}/${_base_dir}")
43           install(FILES ${files_list} DESTINATION ${_dir}/${_base_dir})
44         endif()
45       endforeach(_current_dir)
46     endforeach(_glob_dir)
47   endforeach(_dir)
48 endmacro(lyx_install)
49
50 # language-specific-directories (like ca, de, es ...) are now globbed as "[a-z][a-z]"
51 set(_all_languages "[a-z][a-z]")
52
53 lyx_install(${TOP_SRC_DIR}/lib bind         *.bind   . ${_all_languages})
54 lyx_install(${TOP_SRC_DIR}/lib commands     *.def    .)
55
56 # this is handled in doc/CMakefile.txt
57 #lyx_install(${TOP_SRC_DIR}/lib doc          *.lyx    . ${_all_languages})
58 #lyx_install(${TOP_SRC_DIR}/lib doc          *.txt    . ${_all_languages})
59 lyx_install(${TOP_SRC_DIR}/lib doc          *      biblio clipart)
60
61 lyx_install(${TOP_SRC_DIR}/lib doc/${_all_languages} *    clipart)
62
63 lyx_install(${TOP_SRC_DIR}/lib examples     *      . ${_all_languages})
64 lyx_install(${TOP_SRC_DIR}/lib fonts        *      .)
65 lyx_install(${TOP_SRC_DIR}/lib images       *      . math commands attic)
66 lyx_install(${TOP_SRC_DIR}/lib kbd          *      .)
67 lyx_install(${TOP_SRC_DIR}/lib layouts      *      .)
68 lyx_install(${TOP_SRC_DIR}/lib lyx2lyx      *      .)
69 lyx_install(${TOP_SRC_DIR}/lib scripts      *      .)
70 lyx_install(${TOP_SRC_DIR}/lib templates    *      .)
71 lyx_install(${TOP_SRC_DIR}/lib tex          *      .)
72 lyx_install(${TOP_SRC_DIR}/lib ui           *      .)
73 lyx_install(${TOP_SRC_DIR}/lib .            *      .)
74
75 install(PROGRAMS ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx DESTINATION lyx2lyx)
76