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