]> git.lyx.org Git - features.git/blob - development/cmake/src/support/CMakeLists.txt
a98fadfbcea9093f21955b42f2db32bd9fcf1e2b
[features.git] / development / cmake / src / support / 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 project(support)
8
9 file(GLOB support_sources ${TOP_SRC_DIR}/src/support/${LYX_CPP_FILES})
10 file(GLOB moc_files ${TOP_SRC_DIR}/src/support/${LYX_MOC_FILES})
11 list(REMOVE_ITEM support_sources ${moc_files} .)
12 if(APPLE)
13         list(APPEND support_sources ${TOP_SRC_DIR}/src/support/AppleSpeller.m)
14 endif()
15
16 file(GLOB support_headers ${TOP_SRC_DIR}/src/support/${LYX_HPP_FILES})
17
18 file(GLOB support_mythes_sources ${TOP_SRC_DIR}/src/support/mythes/*.cxx)
19 file(GLOB support_mythes_headers ${TOP_SRC_DIR}/src/support/mythes/*.hxx)
20
21 file(GLOB support_linkback_sources ${TOP_SRC_DIR}/src/support/linkback/*.m*)
22 file(GLOB support_linkback_headers ${TOP_SRC_DIR}/src/support/linkback/*.h)
23
24 list(REMOVE_ITEM support_sources
25         ${TOP_SRC_DIR}/src/support/os_win32.cpp
26         ${TOP_SRC_DIR}/src/support/os_unix.cpp
27         ${TOP_SRC_DIR}/src/support/os_cygwin.cpp
28         ${TOP_SRC_DIR}/src/support/os_os2.C
29         ${TOP_SRC_DIR}/src/support/atexit.c
30         ${TOP_SRC_DIR}/src/support/strerror.c
31         ${TOP_SRC_DIR}/src/support/gettext.cpp)
32
33 if(APPLE)
34         message(STATUS "Mac LinkBack support")
35 else()
36         set(support_linkback_sources "")
37         set(support_linkback_headers "")
38 endif()
39
40 # needed to compile tex2lyx in merged mode
41 set(dont_merge ${TOP_SRC_DIR}/src/support/gettext.cpp)
42
43 lyx_add_msvc_pch(support)
44
45 lyx_automoc(${support_sources})
46
47 include_directories(${TOP_SRC_DIR}/src/support
48         ${CMAKE_BINARY_DIR}/src/support
49         ${TOP_SRC_DIR}/src/support/mythes
50         ${QT_INCLUDES}
51         ${ICONV_INCLUDE_DIR}
52         ${ZLIB_INCLUDE_DIR}
53         ${OPENSSL_INCLUDE_DIR})
54
55
56 if(NOT LYX_MERGE_FILES)
57         set(support_sources ${support_sources} ${support_mythes_sources} ${support_linkback_sources})
58         set(support_headers ${support_headers} ${support_mythes_headers} ${support_linkback_headers})
59         add_library(support ${library_type} ${support_sources} ${support_headers} ${dont_merge})
60 else()
61         # GCC bug: gcc resolves ::bind as boost::bind
62         set(support_separate ${TOP_SRC_DIR}/src/support/socktools.cpp ${TOP_SRC_DIR}/src/support/Messages.cpp)
63         list(REMOVE_ITEM support_sources ${support_separate})
64         lyx_const_touched_files(_allinone  support_sources)
65         set(depends_moc ${support_headers})
66         set_source_files_properties(_allinone_const.C
67                 PROPERTIES OBJECT_DEPENDS "${depends_moc}")
68         set_source_files_properties(_allinone_touched.C
69                 PROPERTIES OBJECT_DEPENDS "${depends_moc}")
70         add_library(support ${library_type} ${_allinone_files} ${support_separate}
71                 ${support_mythes_sources} ${support_linkback_sources} ${support_headers} ${dont_merge})
72 endif()
73
74 target_link_libraries(support ${Lyx_Boost_Libraries} ${QT_QTCORE_LIBRARY} ${ZLIB_LIBRARY} ${OPENSSL_LIBRARIES})
75
76 lyx_add_gcc_pch(support)
77
78 if(APPLE)
79         target_link_libraries(support "objc" "-framework Appkit" "-framework CoreFoundation")
80 elseif(WIN32)
81         target_link_libraries(support shlwapi psapi)
82 endif()
83
84 project_source_group("${GROUP_CODE}" support_sources support_headers)
85