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