]> git.lyx.org Git - lyx.git/blob - development/cmake/CMakeLists.txt
- use version.C.in file instead of a simple copy
[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 if(WIN32)
19         set(USE_WINDOWS_PACKAGING 1)
20 else(WIN32)
21         set(USE_POSIX_PACKAGING 1)
22 endif(WIN32)
23
24 if(NOT GROUP_CODE)
25         #set(GROUP_CODE "The Golden Code")
26         set(GROUP_CODE flat)
27 endif(NOT GROUP_CODE)
28
29 include(LyXPaths)
30 include(LyXMacros)
31 include(ProjectSourceGroup)
32
33 if(release)
34         set(CMAKE_BUILD_TYPE Release)
35         set(release)
36 endif(release)  
37
38
39 if(qt3)
40         set(qt_postfix qt3)
41         project(lyx-${qt_postfix})
42         set(QT_MT_REQUIRED TRUE)
43         find_package(Qt3 REQUIRED)
44         set(qt3)
45         set(build_qt3_frontend TRUE)
46         if(QT_FOUND)
47                 message("-- Found Qt3: ${QT_QT_LIBRARY}")
48         else(QT_FOUND)
49                  MESSAGE( FATAL_ERROR "Qt3 not found")
50         endif(QT_FOUND)
51 else(qt3)
52         set(qt_postfix qt4)
53         project(lyx-${qt_postfix})
54         find_package(Qt4 REQUIRED)
55         
56 endif(qt3)      
57
58 find_package(ZLIB REQUIRED)
59 find_package(ICONV REQUIRED)
60 add_definitions(-DHAVE_ICONV=1)
61
62 if(all OR aspell)
63         find_package(ASPELL REQUIRED)
64 else(all OR aspell)
65         find_package(ASPELL)
66 endif(all OR aspell)
67 set(aspell)
68
69 message("")
70 if(nls OR all)
71         add_definitions(-DENABLE_NLS=1)
72         message("----- Building with ENABLE_NLS")
73 else(nls OR all)        
74         message("----- No nls, to enable use -Dnls=1")
75 endif(nls OR all)
76 set(nls)
77 if(ASPELL_FOUND)
78         add_definitions(-DUSE_ASPELL=1)
79         message("----- Building with USE_ASPELL")
80 else(ASPELL_FOUND)      
81         message("----- No aspell, to get more information use -Daspell=1")
82 endif(ASPELL_FOUND)
83 message("")
84 set(all)
85
86 # create config.h
87 include(ConfigureChecks.cmake)
88 configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
89
90
91 if(MSVC)
92         if(MSVC_IDE)
93                 add_definitions(-DBOOST_USER_CONFIG=&lt\;config.h&gt\;)
94         else(MSVC_IDE)
95                 add_definitions(-DBOOST_USER_CONFIG="<config.h>")
96                 SET(CMAKE_EXE_LINKER_FLAGS /MANIFEST)
97         endif(MSVC_IDE)
98
99         SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Zi -wd4996 -wd4800" CACHE STRING "runtime-library flags" FORCE)
100         SET(CMAKE_CXX_FLAGS_RELEASE  "${CMAKE_CXX_FLAGS_RELEASE} -wd4996 -wd4800" CACHE STRING "runtime-library flags" FORCE)
101         SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
102         SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
103 else(MSVC)
104         add_definitions(-DBOOST_USER_CONFIG="<config.h>")
105 endif(MSVC)
106
107
108 #TODO: insource is not the best place
109 configure_file(${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx_version.py.in 
110                ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx_version.py)
111      
112 include_directories( 
113         ${CMAKE_BINARY_DIR} 
114         ${TOP_SRC_DIR}/src 
115         ${TOP_SRC_DIR}/boost 
116         ${QT_INCLUDES} 
117 )
118
119 add_subdirectory(boost)
120 add_subdirectory(intl)
121 add_subdirectory(src)