]> git.lyx.org Git - lyx.git/blobdiff - development/cmake/CMakeLists.txt
cmake: more merged build fixes
[lyx.git] / development / cmake / CMakeLists.txt
index d02f3158c1178079868da61daa5c8f7e6613f618..9b204b32dc589f6700e1d5d88864c6f733cc3fc3 100644 (file)
@@ -1,3 +1,4 @@
+
 # This file is part of LyX, the document processor.
 # Licence details can be found in the file COPYING.
 #
@@ -19,12 +20,14 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
 # is checked
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
 set(EXECUTABLE_OUTPUT_PATH  ${CMAKE_BINARY_DIR}/bin)
+set(LIBRARY_OUTPUT_PATH  ${CMAKE_BINARY_DIR}/lib)
 
 
 option(lyxinstall "Build install projects/rules" ON)
 
 
 
+
 # Supress regeneration
 set(CMAKE_SUPPRESS_REGENERATION TRUE)
 
@@ -108,6 +111,7 @@ endif()
 # lyx's source files
 set(LYX_CPP_FILES *.cpp)
 set(LYX_HPP_FILES *.h)
+set(LYX_MOC_FILES moc_*.cpp)
 
 include(LyXMacros)
 include(ProjectSourceGroup)
@@ -118,6 +122,7 @@ if(merge OR merge_rebuild)
        message(STATUS "")
        message(STATUS "All *.cpp files of a project are merged into two files, disable with -Dmerge=0")
        message(STATUS "")
+       add_definitions(-DLYX_MERGED_BUILD)
 else()
        set(merge 0 CACHE TYPE STRING FORCE)
        set(MERGE_FILES 0 CACHE TYPE STRING FORCE)
@@ -169,7 +174,7 @@ if(NOT MSVC)
                set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCPP_CONCEPT_CHECKS")
        endif()
        set(CMAKE_CXX_FLAGS          "${LYX_CXX_FLAGS} -fno-strict-aliasing " CACHE TYPE STRING FORCE)
-       set(CMAKE_CXX_FLAGS_DEBUG    "${LYX_CXX_FLAGS} -fno-strict-aliasing -O -g -D_DEBUG" CACHE TYPE STRING FORCE)
+       set(CMAKE_CXX_FLAGS_DEBUG    "${LYX_CXX_FLAGS} -fno-strict-aliasing -O  -D_DEBUG" CACHE TYPE STRING FORCE)
        if(MINGW)
                set(CMAKE_CXX_FLAGS_RELEASE  "${LYX_CXX_FLAGS} -O2 -DNDEBUG" CACHE TYPE STRING FORCE)
        else()
@@ -203,7 +208,7 @@ if(WIN32)
   find_library(HUNSPELL_LIBRARY "libhunspell")
 else()
   #find_library(HUNSPELL_LIBRARY NAME "hunspell" PATH "/usr/local/lib" "/usr/lib" NO_DEFAULT_PATH)
-  find_library(HUNSPELL_LIBRARY "hunspell" "/usr/local/lib" "/usr/lib")
+  find_library(HUNSPELL_LIBRARY NAMES "hunspell" "hunspell-1.2" PATHS "/usr/local/lib" "/usr/lib" "/usr/lib64")
 endif()
 if (HUNSPELL_LIBRARY)
   find_file(HUNSPELL_FOUND "hunspell/hunspell.hxx")
@@ -220,8 +225,8 @@ if(WIN32)
   find_library(ENCHANT_LIBRARY "libenchant")
   find_path(ENCHANT_INCLUDE_DIR "enchant++.h")
 else()
-  find_library(ENCHANT_LIBRARY "enchant"  "/usr/local/lib" "/usr/lib")
-  find_path(ENCHANT_INCLUDE_DIR "enchant++.h" PATHS /usr/local/include /usr/local/include/enchant /usr/include /usr/include/enchant)
+  find_library(ENCHANT_LIBRARY "enchant"  "/usr/local/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib")
+  find_path(ENCHANT_INCLUDE_DIR "enchant++.h" PATHS /usr/local/include /usr/local/include/enchant /usr/include /usr/include/enchant /opt/local/include/enchant)
 endif()
 if (ENCHANT_LIBRARY AND ENCHANT_INCLUDE_DIR)
   set(ENCHANT_FOUND TRUE)
@@ -284,7 +289,7 @@ message(STATUS "")
 # Not sure if it works for all non-msvc compilers
 include(PCHSupport_26)
 if (MSVC)
-       option(disable-pch "Disable precompiled headers" OFF)
+       option(disable-pch "Disable precompiled headers" ON)
 else()
        option(disable-pch "Disable precompiled headers" ON)
 endif()
@@ -373,7 +378,7 @@ if(MSVC)
                # add here warnings which should produce an error /weXXXX
                set(MSVC_W_ERROR   "/we4101 /we4189")
                # add here warnings which should be disabled /wdXXXX
-               set(MSVC_W_DISABLE "/wd4288 /wd4355 /wd4800 /wd4996 /wd4311 /wd4312 /wd4505 /wd4267 /wd4512 /wd4245 /wd4127 /wd4180")
+               set(MSVC_W_DISABLE "/wd4288 /wd4355 /wd4800 /wd4996 /wd4311 /wd4312 /wd4505 /wd4267 /wd4512 /wd4245 /wd4127 /wd4180 /wd4231")
 
                set(CMAKE_CXX_FLAGS_DEBUG
                        "${CMAKE_CXX_FLAGS_DEBUG} /Wp64 ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
@@ -391,7 +396,7 @@ if(MSVC)
                # add here warnings which should produce an error /weXXXX
                set(MSVC_W_ERROR   "/we4101 /we4189")
                # add here warnings which should be disabled /wdXXXX
-               set(MSVC_W_DISABLE "/wd4288 /wd4355 /wd4800 /wd4996 /wd4267 /wd4180")
+               set(MSVC_W_DISABLE "/wd4288 /wd4355 /wd4800 /wd4996 /wd4267 /wd4180 /wd4231")
 
                set(CMAKE_CXX_FLAGS_DEBUG
                        "${CMAKE_CXX_FLAGS_DEBUG} ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
@@ -401,6 +406,12 @@ if(MSVC)
                        "${CMAKE_CXX_FLAGS_MINSIZEREL} ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
 
        endif()
+       set(CMAKE_CXX_FLAGS_DEBUG
+               "${CMAKE_CXX_FLAGS_DEBUG} /Zc:wchar_t-")
+       set(CMAKE_CXX_FLAGS_RELEASE
+               "${CMAKE_CXX_FLAGS_RELEASE} /Zc:wchar_t-")
+       set(CMAKE_CXX_FLAGS_MINSIZEREL
+               "${CMAKE_CXX_FLAGS_MINSIZEREL} /Zc:wchar_t-")
 
        message(STATUS "----- Warning level      : ${CMAKE_CXX_WARNING_LEVEL}  ${WARNING_LEVEL_MESSAGE}")
        message(STATUS "----- Warnings as errors : ${MSVC_W_ERROR}")
@@ -419,6 +430,17 @@ if(NOT ${_PERL_EXECUTABLE} MATCHES "-NOTFOUND")
     endif()
 endif()
 
+option(debug_glibc "Enable libstdc++ debug mode" OFF)
+option(debug_glibc_pedantic "Enable libstdc++pedantic debug mode" OFF)
+
+if(debug_glibc)
+  set(_GLIBCXX_DEBUG 1)
+endif()
+
+if(debug_glibc_pedantic)
+  set(_GLIBCXX_DEBUG_PEDANTIC 1)
+endif()
+
 # compiler tests, config.h generation
 if(MSVC AND NOT CONFIGURECHECKS)
        configure_file(configCompiler.h.msvc ${CMAKE_BINARY_DIR}/configCompiler.h)