]> git.lyx.org Git - lyx.git/blob - development/cmake/CMakeLists.txt
switch ENABLE_ASSERTIONS macro with _DEBUG macro
[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 set(qt_postfix qt4)
40 project(lyx-${qt_postfix})
41 find_package(Qt4 REQUIRED)
42
43 find_package(ZLIB REQUIRED)
44 find_package(ICONV REQUIRED)
45 add_definitions(-DHAVE_ICONV=1)
46
47 if(all OR aspell)
48         set(aspell TRUE CACHE TYPE STRING)
49         find_package(ASPELL REQUIRED)
50 else(all OR aspell)
51         find_package(ASPELL)
52 endif(all OR aspell)
53 set(aspell)
54
55 message("")
56 if(nls OR all)
57         set(nls TRUE CACHE TYPE STRING)
58         add_definitions(-DENABLE_NLS=1)
59         message("----- Building with ENABLE_NLS")
60 else(nls OR all)        
61         message("----- No nls, to enable use -Dnls=1")
62 endif(nls OR all)
63 set(nls)
64 if(ASPELL_FOUND)
65         add_definitions(-DUSE_ASPELL=1)
66         message("----- Building with USE_ASPELL")
67 else(ASPELL_FOUND)      
68         message("----- No aspell, to get more information use -Daspell=1")
69 endif(ASPELL_FOUND)
70 message("")
71 set(all)
72
73 # create config.h
74 include(ConfigureChecks.cmake)
75 configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
76
77
78 if(MSVC)
79         if(MSVC_IDE)
80                 add_definitions(-DBOOST_USER_CONFIG=&lt\;config.h&gt\;)
81         else(MSVC_IDE)
82                 add_definitions(-DBOOST_USER_CONFIG="<config.h>")
83                 SET(CMAKE_EXE_LINKER_FLAGS /MANIFEST)
84         endif(MSVC_IDE)
85
86         ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) 
87
88 else(MSVC)
89         add_definitions(-DBOOST_USER_CONFIG="<config.h>")
90 endif(MSVC)
91
92 if(MSVC AND NOT disable-pch)
93         configure_file(${CMAKE_SOURCE_DIR}/pcheaders.h    ${CMAKE_BINARY_DIR}/pcheaders.h)
94         configure_file(${CMAKE_SOURCE_DIR}/config.C.cmake ${CMAKE_CURRENT_BINARY_DIR}/config_pch.C)
95         macro(lyx_add_msvc_pch name_)
96                 SET_SOURCE_FILES_PROPERTIES(${${name_}_sources} PROPERTIES COMPILE_FLAGS "/Yuconfig.h /Fp\$(IntDir)/config.pch")
97                 SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/config_pch.C PROPERTIES COMPILE_FLAGS "/Ycconfig.h /Fp\$(IntDir)/config.pch")
98                 add_definitions(/DLYX_PRECOMPILED_HEADERS)
99                 set(${name_}_sources ${${name_}_sources} ${CMAKE_BINARY_DIR}/config_pch.C ${CMAKE_BINARY_DIR}/pcheaders.h)
100         endmacro(lyx_add_msvc_pch)
101 else(MSVC AND NOT disable-pch)
102         set(disable-pch TRUE CACHE TYPE STRING)
103         macro(lyx_add_msvc_pch)
104         endmacro(lyx_add_msvc_pch)
105 endif(MSVC AND NOT disable-pch)
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)