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