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