]> git.lyx.org Git - lyx.git/blob - src/support/CMakeLists.txt
Cmake build: Omit also hidden header files from globbing
[lyx.git] / 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-2011 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 dont_merge ${TOP_SRC_DIR}/src/support/AppleSpeller.m)
14         list(APPEND dont_merge ${TOP_SRC_DIR}/src/support/AppleScript.m)
15 endif()
16
17 file(GLOB support_headers ${TOP_SRC_DIR}/src/support/${LYX_HPP_FILES})
18
19 file(GLOB support_mythes_sources ${TOP_SRC_DIR}/src/support/mythes/*.cxx)
20 file(GLOB support_mythes_headers ${TOP_SRC_DIR}/src/support/mythes/*.hxx)
21
22 file(GLOB support_linkback_sources ${TOP_SRC_DIR}/src/support/linkback/*.m*)
23 file(GLOB support_linkback_headers ${TOP_SRC_DIR}/src/support/linkback/*.h)
24
25 set_source_files_properties(${support_linkback_sources} 
26         ${TOP_SRC_DIR}/src/support/AppleSpeller.m
27         ${TOP_SRC_DIR}/src/support/AppleScript.m
28                 PROPERTIES COMPILE_FLAGS "-std=c99")
29
30 list(REMOVE_ITEM support_sources
31         ${TOP_SRC_DIR}/src/support/os_win32.cpp
32         ${TOP_SRC_DIR}/src/support/os_unix.cpp
33         ${TOP_SRC_DIR}/src/support/os_cygwin.cpp
34         ${TOP_SRC_DIR}/src/support/os_os2.C
35         ${TOP_SRC_DIR}/src/support/gettext.cpp)
36
37 if(APPLE)
38         message(STATUS "Mac LinkBack support")
39 else()
40         set(support_linkback_sources "")
41         set(support_linkback_headers "")
42 endif()
43
44 if(UNIX AND CMAKE_COMPILER_IS_GNUCC AND NOT APPLE)
45         add_definitions(-DLYX_CALLSTACK_PRINTING)
46 endif()
47
48 add_subdirectory(tests)
49
50 # needed to compile tex2lyx in merged mode
51 set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/support/gettext.cpp)
52
53 lyx_add_msvc_pch(support)
54
55 lyx_automoc(${support_sources})
56
57 include_directories(
58         ${TOP_SRC_DIR}/src/support
59         ${TOP_BINARY_DIR}/src/support
60         ${TOP_SRC_DIR}/src/support/mythes
61         ${QT_INCLUDES}
62         ${ICONV_INCLUDE_DIR}
63         ${ZLIB_INCLUDE_DIR})
64
65
66 if(NOT LYX_MERGE_FILES)
67         set(support_sources ${support_sources} ${support_mythes_sources} ${support_linkback_sources})
68         set(support_headers ${support_headers} ${support_mythes_headers} ${support_linkback_headers})
69         add_library(support ${library_type} ${support_sources} ${support_headers} ${dont_merge})
70 else()
71         # GCC bug: gcc resolves ::bind as boost::bind
72         set(support_separate ${TOP_SRC_DIR}/src/support/socktools.cpp ${TOP_SRC_DIR}/src/support/Messages.cpp)
73         list(REMOVE_ITEM support_sources ${support_separate})
74         lyx_const_touched_files(_allinone  support_sources)
75         set(depends_moc ${support_headers})
76         set_source_files_properties(_allinone_const.C
77                 PROPERTIES OBJECT_DEPENDS "${depends_moc}")
78         set_source_files_properties(_allinone_touched.C
79                 PROPERTIES OBJECT_DEPENDS "${depends_moc}")
80         add_library(support ${library_type} ${_allinone_files} ${support_separate}
81                 ${support_mythes_sources} ${support_linkback_sources} ${support_headers} ${dont_merge})
82 endif()
83 set_target_properties(support PROPERTIES FOLDER "applications/LyX")
84
85 if(USE_MACOSX_PACKAGING AND Qt5Core_FOUND)
86        qt_use_modules(support Core Gui)
87 else()
88        qt_use_modules(support Core)
89 endif()
90
91 target_link_libraries(support ${Lyx_Boost_Libraries} ${QT_QTCORE_LIBRARY} ${ZLIB_LIBRARY})
92
93 lyx_add_gcc_pch(support)
94
95 if(APPLE)
96         target_link_libraries(support "objc" "-framework AppKit" "-framework CoreFoundation")
97         if(CMAKE_COMPILER_IS_GNUCXX)
98                 set_source_files_properties(${support_sources} PROPERTIES COMPILE_FLAGS "-fobjc-exceptions")
99         endif()
100 elseif(WIN32)
101         target_link_libraries(support shlwapi psapi)
102 endif()
103
104 project_source_group("${GROUP_CODE}" support_sources support_headers)
105