]> git.lyx.org Git - lyx.git/blob - development/cmake/CMakeLists.txt
cmake: don't forget command line options
[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 endif(qt3)      
61
62 find_package(ZLIB REQUIRED)
63 find_package(ICONV REQUIRED)
64 add_definitions(-DHAVE_ICONV=1)
65
66 if(all OR aspell)
67         set(aspell TRUE CACHE TYPE STRING)
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         set(nls TRUE CACHE TYPE STRING)
77         add_definitions(-DENABLE_NLS=1)
78         message("----- Building with ENABLE_NLS")
79 else(nls OR all)        
80         message("----- No nls, to enable use -Dnls=1")
81 endif(nls OR all)
82 set(nls)
83 if(ASPELL_FOUND)
84         add_definitions(-DUSE_ASPELL=1)
85         message("----- Building with USE_ASPELL")
86 else(ASPELL_FOUND)      
87         message("----- No aspell, to get more information use -Daspell=1")
88 endif(ASPELL_FOUND)
89 message("")
90 set(all)
91
92 # create config.h
93 include(ConfigureChecks.cmake)
94 configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
95
96
97 if(MSVC)
98         if(MSVC_IDE)
99                 add_definitions(-DBOOST_USER_CONFIG=&lt\;config.h&gt\;)
100         else(MSVC_IDE)
101                 add_definitions(-DBOOST_USER_CONFIG="<config.h>")
102                 SET(CMAKE_EXE_LINKER_FLAGS /MANIFEST)
103         endif(MSVC_IDE)
104
105         SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Zi -wd4996 -wd4800" CACHE STRING "runtime-library flags" FORCE)
106         SET(CMAKE_CXX_FLAGS_RELEASE  "${CMAKE_CXX_FLAGS_RELEASE} -wd4996 -wd4800" CACHE STRING "runtime-library flags" FORCE)
107         SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
108         SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
109 else(MSVC)
110         add_definitions(-DBOOST_USER_CONFIG="<config.h>")
111 endif(MSVC)
112
113
114 #TODO: insource is not the best place
115 configure_file(${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx_version.py.in 
116                ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx_version.py)
117      
118 include_directories( 
119         ${CMAKE_BINARY_DIR} 
120         ${TOP_SRC_DIR}/src 
121         ${TOP_SRC_DIR}/boost 
122         ${QT_INCLUDES} 
123 )
124
125 add_subdirectory(boost)
126 add_subdirectory(intl)
127 add_subdirectory(src)