]> git.lyx.org Git - lyx.git/blob - development/cmake/src/CMakeLists.txt
cmake: add pch for gcc, it's sooo hairy, disable by default
[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 lyx_headers ${TOP_SRC_DIR}/src/${LYX_HPP_FILES})
24
25 list(REMOVE_ITEM lyx_sources
26         ${TOP_SRC_DIR}/src/AspellChecker.cpp
27         ${TOP_SRC_DIR}/src/HunspellChecker.cpp
28         ${TOP_SRC_DIR}/src/Variables.cpp
29         ${TOP_SRC_DIR}/src/Section.cpp)
30
31 list(REMOVE_ITEM lyx_headers
32         ${TOP_SRC_DIR}/src/AspellChecker.h
33         ${TOP_SRC_DIR}/src/HunspellChecker.h
34         ${TOP_SRC_DIR}/src/Variables.h
35         ${TOP_SRC_DIR}/src/Section.h)
36
37 if (HUNSPELL_FOUND)
38         list(APPEND lyx_sources ${TOP_SRC_DIR}/src/HunspellChecker.cpp)
39         list(APPEND lyx_headers ${TOP_SRC_DIR}/src/HunspellChecker.h)
40 endif()
41
42 if (ASPELL_FOUND)
43         include_directories(${ASPELL_INCLUDE_DIR})
44         list(APPEND lyx_sources ${TOP_SRC_DIR}/src/AspellChecker.cpp)
45         list(APPEND lyx_headers ${TOP_SRC_DIR}/src/AspellChecker.h)
46 endif()
47
48 lyx_automoc(${TOP_SRC_DIR}/src/Compare.cpp ${TOP_SRC_DIR}/src/Server.cpp)
49
50 include_directories(${CMAKE_CURRENT_BINARY_DIR}
51         ${ZLIB_INCLUDE_DIR} ${QT_INCLUDES})
52
53 lyx_add_msvc_pch(lyx)
54
55
56 if (MERGE_FILES)
57         lyx_const_touched_files(_allinone  lyx_sources)
58         set(lyx_sources ${_allinone_files})
59 endif()
60
61 if (LYX_LEAK_DETECTION)
62         configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/vld.ini COPYONLY)
63         configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt COPYONLY)
64         set(vld_files ${CMAKE_CURRENT_BINARY_DIR}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt)
65 endif()
66
67 add_executable(${_lyx}
68         ${WIN32_CONSOLE}
69         ${lyx_sources}
70         ${lyx_headers}
71         ${vld_files}
72 )
73
74 lyx_add_gcc_pch(lyx)
75
76 target_link_libraries(${_lyx}
77         mathed
78         insets
79         frontends
80         frontend_qt4
81         graphics
82         support
83         ${LIBINTL_LIBRARIES}
84         ${ICONV_LIBRARY}
85         ${QT_QTMAIN_LIBRARY}
86         ${vld_dll})
87
88 if (HUNSPELL_FOUND)
89         target_link_libraries(${_lyx} ${HUNSPELL_LIBRARY})
90 endif()
91 if (ASPELL_FOUND)
92         target_link_libraries(${_lyx} ${ASPELL_LIBRARY})
93 endif()
94
95 if (APPLE)
96   target_link_libraries(${_lyx} "-bind_at_load")
97   target_link_libraries(${_lyx} "-framework Carbon")
98 endif()
99
100 if (MINGW)
101   target_link_libraries(${_lyx} ole32)
102 endif()
103
104 project_source_group("${GROUP_CODE}" lyx_sources lyx_headers)
105
106 install(TARGETS ${_lyx} DESTINATION bin)
107