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