]> git.lyx.org Git - lyx.git/blob - development/cmake/src/CMakeLists.txt
cmake: fix merged build
[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         ${TOP_SRC_DIR}/src/lyxinsets.cpp
35         ${TOP_SRC_DIR}/src/lyxmathed.cpp)
36
37 if(NOT APPLE)
38   list(REMOVE_ITEM lyx_sources
39     ${TOP_SRC_DIR}/src/AppleSpellChecker.cpp)
40    list(REMOVE_ITEM lyx_headers
41     ${TOP_SRC_DIR}/src/AppleSpellChecker.h)
42 endif()
43
44 list(REMOVE_ITEM lyx_headers
45         ${TOP_SRC_DIR}/src/EnchantChecker.h
46         ${TOP_SRC_DIR}/src/AspellChecker.h
47         ${TOP_SRC_DIR}/src/HunspellChecker.h
48         ${TOP_SRC_DIR}/src/Variables.h
49         ${TOP_SRC_DIR}/src/Section.h)
50
51 if (HUNSPELL_FOUND)
52         list(APPEND lyx_sources ${TOP_SRC_DIR}/src/HunspellChecker.cpp)
53         list(APPEND lyx_headers ${TOP_SRC_DIR}/src/HunspellChecker.h)
54         set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/HunspellChecker.cpp)
55 endif()
56
57 if (ASPELL_FOUND)
58         include_directories(${ASPELL_INCLUDE_DIR})
59         list(APPEND lyx_sources ${TOP_SRC_DIR}/src/AspellChecker.cpp)
60         list(APPEND lyx_headers ${TOP_SRC_DIR}/src/AspellChecker.h)
61         set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/AspellChecker.cpp)
62 endif()
63
64 if (ENCHANT_FOUND)
65   include_directories("${ENCHANT_INCLUDE_DIR}")
66   list(APPEND lyx_sources ${TOP_SRC_DIR}/src/EnchantChecker.cpp)
67   list(APPEND lyx_headers ${TOP_SRC_DIR}/src/EnchantChecker.h)
68   set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/EnchantChecker.cpp)
69 endif()
70
71 lyx_automoc(${TOP_SRC_DIR}/src/Compare.cpp)
72 if (WIN32)
73   lyx_automoc(${TOP_SRC_DIR}/src/Server.cpp)
74 endif()
75
76 include_directories(${CMAKE_CURRENT_BINARY_DIR}
77         ${ZLIB_INCLUDE_DIR} ${QT_INCLUDES})
78
79 lyx_add_msvc_pch(lyx)
80
81
82 if (LYX_MERGE_FILES)
83         list(REMOVE_ITEM lyx_sources ${dont_merge})
84         lyx_const_touched_files(_allinone lyx_sources)
85         set(lyx_sources ${_allinone_files} ${dont_merge})
86 endif()
87
88 if (LYX_VLD)
89         configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/vld.ini COPYONLY)
90         configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt COPYONLY)
91         set(vld_files ${CMAKE_CURRENT_BINARY_DIR}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt)
92 endif()
93
94 if(WIN32)
95         set(FILE_RC ${CMAKE_SOURCE_DIR}/lyx.rc)
96         message(STATUS "Using icon defined in resource file: ${FILE_RC}")
97 endif()
98
99 add_executable(${_lyx}
100         ${WIN32_CONSOLE}
101         ${lyx_sources}
102         ${lyx_headers}
103         ${vld_files}
104         ${FILE_RC}
105 )
106
107 lyx_add_gcc_pch(${_lyx})
108
109 target_link_libraries(${_lyx}
110         mathed
111         insets
112         frontends
113         frontend_qt4
114         graphics
115         support
116         ${LIBINTL_LIBRARIES}
117         ${ICONV_LIBRARY}
118         ${QT_QTMAIN_LIBRARY}
119         ${vld_dll})
120
121 if (HUNSPELL_FOUND)
122         target_link_libraries(${_lyx} ${HUNSPELL_LIBRARY})
123 endif()
124 if (ASPELL_FOUND)
125         target_link_libraries(${_lyx} ${ASPELL_LIBRARY})
126 endif()
127 if (ENCHANT_FOUND)
128     target_link_libraries(${_lyx} ${ENCHANT_LIBRARY})
129 endif()
130
131 if (APPLE)
132   target_link_libraries(${_lyx} "-bind_at_load")
133   target_link_libraries(${_lyx} "-framework Carbon")
134 endif()
135
136 if (MINGW)
137   target_link_libraries(${_lyx} ole32)
138 endif()
139
140 project_source_group("${GROUP_CODE}" lyx_sources lyx_headers)
141
142 install(TARGETS ${_lyx} DESTINATION bin)
143