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