]> git.lyx.org Git - lyx.git/blob - development/cmake/src/CMakeLists.txt
ddcb5cde20ab7ca7db04c9322f4a7893de3546d2
[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
34 list(REMOVE_ITEM lyx_headers
35         ${TOP_SRC_DIR}/src/EnchantChecker.h
36         ${TOP_SRC_DIR}/src/AspellChecker.h
37         ${TOP_SRC_DIR}/src/HunspellChecker.h
38         ${TOP_SRC_DIR}/src/Variables.h
39         ${TOP_SRC_DIR}/src/Section.h)
40
41 if (HUNSPELL_FOUND)
42         list(APPEND lyx_sources ${TOP_SRC_DIR}/src/HunspellChecker.cpp)
43         list(APPEND lyx_headers ${TOP_SRC_DIR}/src/HunspellChecker.h)
44 endif()
45
46 if (ASPELL_FOUND)
47         include_directories(${ASPELL_INCLUDE_DIR})
48         list(APPEND lyx_sources ${TOP_SRC_DIR}/src/AspellChecker.cpp)
49         list(APPEND lyx_headers ${TOP_SRC_DIR}/src/AspellChecker.h)
50 endif()
51
52 if (ENCHANT_FOUND)
53   include_directories("${ENCHANT_INCLUDE_DIR}")
54   list(APPEND lyx_sources ${TOP_SRC_DIR}/src/EnchantChecker.cpp)
55   list(APPEND lyx_headers ${TOP_SRC_DIR}/src/EnchantChecker.h)
56 endif()
57
58 lyx_automoc(${TOP_SRC_DIR}/src/Compare.cpp ${TOP_SRC_DIR}/src/Server.cpp)
59
60 include_directories(${CMAKE_CURRENT_BINARY_DIR}
61         ${ZLIB_INCLUDE_DIR} ${QT_INCLUDES})
62
63 lyx_add_msvc_pch(lyx)
64
65
66 if (MERGE_FILES)
67         lyx_const_touched_files(_allinone  lyx_sources)
68         set(lyx_sources ${_allinone_files})
69 endif()
70
71 if (LYX_LEAK_DETECTION)
72         configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/vld.ini COPYONLY)
73         configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt COPYONLY)
74         set(vld_files ${CMAKE_CURRENT_BINARY_DIR}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt)
75 endif()
76
77 add_executable(${_lyx}
78         ${WIN32_CONSOLE}
79         ${lyx_sources}
80         ${lyx_headers}
81         ${vld_files}
82 )
83
84 lyx_add_gcc_pch(${_lyx})
85
86 target_link_libraries(${_lyx}
87         mathed
88         insets
89         frontends
90         frontend_qt4
91         graphics
92         support
93         ${LIBINTL_LIBRARIES}
94         ${ICONV_LIBRARY}
95         ${QT_QTMAIN_LIBRARY}
96         ${vld_dll})
97
98 if (HUNSPELL_FOUND)
99         target_link_libraries(${_lyx} ${HUNSPELL_LIBRARY})
100 endif()
101 if (ASPELL_FOUND)
102         target_link_libraries(${_lyx} ${ASPELL_LIBRARY})
103 endif()
104 if (ENCHANT_FOUND)
105     target_link_libraries(${_lyx} ${ENCHANT_LIBRARY})
106 endif()
107
108 if (APPLE)
109   target_link_libraries(${_lyx} "-bind_at_load")
110   target_link_libraries(${_lyx} "-framework Carbon")
111 endif()
112
113 if (MINGW)
114   target_link_libraries(${_lyx} ole32)
115 endif()
116
117 project_source_group("${GROUP_CODE}" lyx_sources lyx_headers)
118
119 install(TARGETS ${_lyx} DESTINATION bin)
120