]> git.lyx.org Git - lyx.git/blob - development/cmake/CMakeLists.txt
a89b0017717f6b2732e9bfcd4c723dd814b664a8
[lyx.git] / development / cmake / CMakeLists.txt
1 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
2 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
3
4 include(LyXPaths)
5 include(LyXMacros)
6
7 if(release)
8         set(CMAKE_BUILD_TYPE Release)
9         set(release)
10 endif(release)  
11
12
13 if(qt3)
14         set(qt_postfix qt3)
15         project(lyx-${qt_postfix})
16         set(QT_MT_REQUIRED TRUE)
17         find_package(Qt3 REQUIRED)
18         set(qt3)
19         set(build_qt3_frontend TRUE)
20         if(QT_FOUND)
21                 message("-- Found Qt3: ${QT_QT_LIBRARY}")
22         else(QT_FOUND)
23                  MESSAGE( FATAL_ERROR "Qt3 not found")
24         endif(QT_FOUND)
25 else(qt3)
26         set(qt_postfix qt4)
27         project(lyx-${qt_postfix})
28         find_package(Qt4 REQUIRED)
29         
30 endif(qt3)      
31
32 find_package(ZLIB REQUIRED)
33 find_package(ICONV REQUIRED)
34 add_definitions(-DHAVE_ICONV=1)
35
36 if(all OR aspell)
37         find_package(ASPELL REQUIRED)
38 else(all OR aspell)
39         find_package(ASPELL)
40 endif(all OR aspell)
41 set(aspell)
42
43 message("")
44 if(nls)
45         add_definitions(-DENABLE_NLS=1)
46         message("----- Building with ENABLE_NLS and HAVE_ICONV")
47 endif(nls)
48 set(nls)
49 if(ASPELL_FOUND)
50         add_definitions(-DUSE_ASPELL=1)
51         message("----- Building with USE_ASPELL")
52 else(ASPELL_FOUND)      
53         message("----- No aspell, to get more information use -Daspell=1")
54 endif(ASPELL_FOUND)
55 message("")
56 set(all)
57
58 # create config.h
59 include(ConfigureChecks.cmake)
60 configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
61
62
63 if(MSVC)
64         if(MSVC_IDE)
65                 add_definitions(-DBOOST_USER_CONFIG=&lt\;config.h&gt\;)
66         else(MSVC_IDE)
67                 add_definitions(-DBOOST_USER_CONFIG="<config.h>")
68                 SET(CMAKE_EXE_LINKER_FLAGS /MANIFEST)
69         endif(MSVC_IDE)
70
71         SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Zi -wd4996 -wd4800" CACHE STRING "runtime-library flags" FORCE)
72         SET(CMAKE_CXX_FLAGS_RELEASE  "${CMAKE_CXX_FLAGS_RELEASE} -wd4996 -wd4800" CACHE STRING "runtime-library flags" FORCE)
73         SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
74         SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
75 else(MSVC)
76         add_definitions(-DBOOST_USER_CONFIG="<config.h>")
77 endif(MSVC)
78
79      
80 include_directories( 
81         ${CMAKE_BINARY_DIR} 
82         ${TOP_SRC_DIR}/src 
83         ${TOP_SRC_DIR}/boost 
84         ${QT_INCLUDES} 
85 )
86
87 add_subdirectory(boost)
88 add_subdirectory(intl)
89 add_subdirectory(src)