]> git.lyx.org Git - lyx.git/blob - development/cmake/CMakeLists.txt
fix wrong line endings of generated Qt4 ui files on Windows
[lyx.git] / development / cmake / 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 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
8 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
9
10 set (EXECUTABLE_OUTPUT_PATH  ${CMAKE_BINARY_DIR}/bin)
11
12 set(PACKAGE lyx)
13 set(PACKAGE_VERSION 1.5.0svn)
14 set(LYX_DATE "not released yet")
15 #TODO
16 set(VERSION_INFO "CMake Build")
17
18 #TODO: add command line option
19 #      enable by default because the cmake 
20 #      build is mostly used for development
21 set(ENABLE_ASSERTIONS 1)
22
23 if(WIN32)
24         set(USE_WINDOWS_PACKAGING 1)
25 else(WIN32)
26         set(USE_POSIX_PACKAGING 1)
27 endif(WIN32)
28
29 if(NOT GROUP_CODE)
30         #set(GROUP_CODE "The Golden Code")
31         set(GROUP_CODE flat)
32 endif(NOT GROUP_CODE)
33
34 include(LyXPaths)
35 include(LyXMacros)
36 include(ProjectSourceGroup)
37
38 if(release)
39         set(CMAKE_BUILD_TYPE Release)
40         set(release)
41 endif(release)  
42
43
44 if(qt3)
45         set(qt_postfix qt3)
46         project(lyx-${qt_postfix})
47         set(QT_MT_REQUIRED TRUE)
48         find_package(Qt3 REQUIRED)
49         set(qt3)
50         set(build_qt3_frontend TRUE)
51         if(QT_FOUND)
52                 message("-- Found Qt3: ${QT_QT_LIBRARY}")
53         else(QT_FOUND)
54                  MESSAGE( FATAL_ERROR "Qt3 not found")
55         endif(QT_FOUND)
56 else(qt3)
57         set(qt_postfix qt4)
58         project(lyx-${qt_postfix})
59         find_package(Qt4 REQUIRED)
60         
61 endif(qt3)      
62
63 find_package(ZLIB REQUIRED)
64 find_package(ICONV REQUIRED)
65 add_definitions(-DHAVE_ICONV=1)
66
67 if(all OR aspell)
68         find_package(ASPELL REQUIRED)
69 else(all OR aspell)
70         find_package(ASPELL)
71 endif(all OR aspell)
72 set(aspell)
73
74 message("")
75 if(nls OR all)
76         add_definitions(-DENABLE_NLS=1)
77         message("----- Building with ENABLE_NLS")
78 else(nls OR all)        
79         message("----- No nls, to enable use -Dnls=1")
80 endif(nls OR all)
81 set(nls)
82 if(ASPELL_FOUND)
83         add_definitions(-DUSE_ASPELL=1)
84         message("----- Building with USE_ASPELL")
85 else(ASPELL_FOUND)      
86         message("----- No aspell, to get more information use -Daspell=1")
87 endif(ASPELL_FOUND)
88 message("")
89 set(all)
90
91 # create config.h
92 include(ConfigureChecks.cmake)
93 configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
94
95
96 if(MSVC)
97         if(MSVC_IDE)
98                 add_definitions(-DBOOST_USER_CONFIG=&lt\;config.h&gt\;)
99         else(MSVC_IDE)
100                 add_definitions(-DBOOST_USER_CONFIG="<config.h>")
101                 SET(CMAKE_EXE_LINKER_FLAGS /MANIFEST)
102         endif(MSVC_IDE)
103
104         SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Zi -wd4996 -wd4800" CACHE STRING "runtime-library flags" FORCE)
105         SET(CMAKE_CXX_FLAGS_RELEASE  "${CMAKE_CXX_FLAGS_RELEASE} -wd4996 -wd4800" CACHE STRING "runtime-library flags" FORCE)
106         SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
107         SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
108 else(MSVC)
109         add_definitions(-DBOOST_USER_CONFIG="<config.h>")
110 endif(MSVC)
111
112
113 #TODO: insource is not the best place
114 configure_file(${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx_version.py.in 
115                ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx_version.py)
116      
117 include_directories( 
118         ${CMAKE_BINARY_DIR} 
119         ${TOP_SRC_DIR}/src 
120         ${TOP_SRC_DIR}/boost 
121         ${QT_INCLUDES} 
122 )
123
124 add_subdirectory(boost)
125 add_subdirectory(intl)
126 add_subdirectory(src)