]> git.lyx.org Git - lyx.git/blob - development/cmake/src/CMakeLists.txt
b19f21ab19f7fa690838577d6c54b1c09143afdc
[lyx.git] / development / cmake / src / CMakeLists.txt
1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
3 #
4 # Copyright (c) 2006, Peter Kümmel, <syntheticpp@gmx.net>
5 #
6
7 set(_lyx ${PACKAGE_BASE}${PROGRAM_SUFFIX})
8 project(${_lyx})
9
10 include_directories(${TOP_SRC_DIR}/src)
11
12 add_subdirectory(frontends)
13 add_subdirectory(graphics)
14 add_subdirectory(insets)
15 add_subdirectory(mathed)
16 add_subdirectory(support)
17 add_subdirectory(tex2lyx)
18 if (UNIX)
19   add_subdirectory(client)
20 endif()
21
22 file(GLOB lyx_sources ${TOP_SRC_DIR}/src/${LYX_CPP_FILES})
23 file(GLOB moc_files ${TOP_SRC_DIR}/src/${LYX_MOC_FILES})
24 list(REMOVE_ITEM  lyx_sources ${moc_files} .)
25 file(GLOB lyx_headers ${TOP_SRC_DIR}/src/${LYX_HPP_FILES})
26
27 list(REMOVE_ITEM lyx_sources
28         ${TOP_SRC_DIR}/src/EnchantChecker.cpp
29         ${TOP_SRC_DIR}/src/AspellChecker.cpp
30         ${TOP_SRC_DIR}/src/HunspellChecker.cpp
31         ${TOP_SRC_DIR}/src/Variables.cpp
32         ${TOP_SRC_DIR}/src/Section.cpp
33         ${TOP_SRC_DIR}/src/lyxcore.cpp)
34
35 if(NOT APPLE)
36   list(REMOVE_ITEM lyx_sources
37     ${TOP_SRC_DIR}/src/AppleSpellChecker.cpp)
38    list(REMOVE_ITEM lyx_headers
39     ${TOP_SRC_DIR}/src/AppleSpellChecker.h)
40 endif()
41
42 list(REMOVE_ITEM lyx_headers
43         ${TOP_SRC_DIR}/src/EnchantChecker.h
44         ${TOP_SRC_DIR}/src/AspellChecker.h
45         ${TOP_SRC_DIR}/src/HunspellChecker.h
46         ${TOP_SRC_DIR}/src/Variables.h
47         ${TOP_SRC_DIR}/src/Section.h)
48
49 if (HUNSPELL_FOUND)
50         list(APPEND lyx_sources ${TOP_SRC_DIR}/src/HunspellChecker.cpp)
51         list(APPEND lyx_headers ${TOP_SRC_DIR}/src/HunspellChecker.h)
52 endif()
53
54 if (ASPELL_FOUND)
55         include_directories(${ASPELL_INCLUDE_DIR})
56         list(APPEND lyx_sources ${TOP_SRC_DIR}/src/AspellChecker.cpp)
57         list(APPEND lyx_headers ${TOP_SRC_DIR}/src/AspellChecker.h)
58 endif()
59
60 if (ENCHANT_FOUND)
61   include_directories("${ENCHANT_INCLUDE_DIR}")
62   list(APPEND lyx_sources ${TOP_SRC_DIR}/src/EnchantChecker.cpp)
63   list(APPEND lyx_headers ${TOP_SRC_DIR}/src/EnchantChecker.h)
64 endif()
65
66 lyx_automoc(${TOP_SRC_DIR}/src/Compare.cpp)
67 if (WIN32)
68   lyx_automoc(${TOP_SRC_DIR}/src/Server.cpp)
69 endif()
70
71 include_directories(${CMAKE_CURRENT_BINARY_DIR}
72         ${ZLIB_INCLUDE_DIR} ${QT_INCLUDES})
73
74 lyx_add_msvc_pch(lyx)
75
76
77 if (LYX_MERGE_FILES)
78         lyx_const_touched_files(_allinone  lyx_sources)
79         set(lyx_sources ${_allinone_files})
80 endif()
81
82 if (LYX_VLD)
83         configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/vld.ini COPYONLY)
84         configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt COPYONLY)
85         set(vld_files ${CMAKE_CURRENT_BINARY_DIR}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt)
86 endif()
87
88 if(WIN32)
89         set(FILE_RC ${CMAKE_SOURCE_DIR}/lyx.rc)
90         message(STATUS "Using icon defined in resource file: ${FILE_RC}")
91 endif()
92
93 add_executable(${_lyx}
94         ${WIN32_CONSOLE}
95         ${lyx_sources}
96         ${lyx_headers}
97         ${vld_files}
98         ${FILE_RC}
99 )
100
101 lyx_add_gcc_pch(${_lyx})
102
103 target_link_libraries(${_lyx}
104         mathed
105         insets
106         frontends
107         frontend_qt4
108         graphics
109         support
110         ${LIBINTL_LIBRARIES}
111         ${ICONV_LIBRARY}
112         ${QT_QTMAIN_LIBRARY}
113         ${vld_dll})
114
115 if (HUNSPELL_FOUND)
116         target_link_libraries(${_lyx} ${HUNSPELL_LIBRARY})
117 endif()
118 if (ASPELL_FOUND)
119         target_link_libraries(${_lyx} ${ASPELL_LIBRARY})
120 endif()
121 if (ENCHANT_FOUND)
122     target_link_libraries(${_lyx} ${ENCHANT_LIBRARY})
123 endif()
124
125 if (APPLE)
126   target_link_libraries(${_lyx} "-bind_at_load")
127   target_link_libraries(${_lyx} "-framework Carbon")
128 endif()
129
130 if (MINGW)
131   target_link_libraries(${_lyx} ole32)
132 endif()
133
134 project_source_group("${GROUP_CODE}" lyx_sources lyx_headers)
135
136 install(TARGETS ${_lyx} DESTINATION bin)
137