]> git.lyx.org Git - lyx.git/blobdiff - development/cmake/CMakeLists.txt
server_monitor.h must be included last for msvc sake.
[lyx.git] / development / cmake / CMakeLists.txt
index 5b2124e778b65e3c1bb35092a67afce0e6acae38..50f38244d40420599ec032e4f1a63a428dac7ae6 100644 (file)
@@ -194,12 +194,20 @@ if(use_external_libintl)
        add_definitions(-DHAVE_GETTEXT)
 endif()
 
-find_file(HUNSPELL_FOUND hunspell.hxx)
+if(WIN32)
+  find_library(HUNSPELL_LIBRARY "libhunspell")
+else()
+  find_library(HUNSPELL_LIBRARY "hunspell")
+endif()
+if (HUNSPELL_LIBRARY)
+  find_file(HUNSPELL_FOUND "hunspell/hunspell.hxx")
+endif()
 
 if (HUNSPELL_FOUND)
-    message(STATUS "----- Building with Hunspell)
+  add_definitions(-DUSE_HUNSPELL=1)
+  message(STATUS "----- Building with USE_HUNSPELL")
 else()
-    message(STATUS "----- Hunspell not found, building without hunspell support")
+  message(STATUS "----- Hunspell not found, building without hunspell support")
 endif()
 
 message(STATUS "")
@@ -251,8 +259,6 @@ endforeach(_v)
 message(STATUS "")
 
 
-add_definitions(-DBOOST_USER_CONFIG="<config.h>")
-
 if(MSVC AND NOT disable-pch AND NOT MERGE_FILES)
        message(STATUS "-----")
        message(STATUS "----- using precompiled headers, disable with -Ddisable-pch=1")
@@ -386,14 +392,33 @@ configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
 find_package(ICONV REQUIRED)
 add_definitions(-DHAVE_ICONV=1)
 
+
 include_directories(
-       ${CMAKE_BINARY_DIR}
-       ${TOP_SRC_DIR}/src
-       ${TOP_SRC_DIR}/boost)
+  ${CMAKE_BINARY_DIR}
+  ${TOP_SRC_DIR}/src)
+
+option(UseExternalBoost "Use external boost" OFF)
+if(UseExternalBoost)
+  message(STATUS "Searching for boost")
+  find_package(Boost COMPONENTS signals regex)
+  if(Boost_FOUND)
+    message(STATUS "Boost found")
+    message(STATUS "Boost-libs = ${Boost_LIBRARIES}")
+    set(Lyx_Boost_Libraries ${Boost_LIBRARIES})
+  else()
+    message(FATAL_ERROR "Boost not found" ${Boost_ERROR_REASON})
+  endif()
+else()
+  message(STATUS "----- Using internal boost. To build with installed version use -DUseExternalBoost:BOOL=ON")
+  set(Lyx_Boost_Libraries boost_signals boost_regex)
+  add_definitions(-DBOOST_USER_CONFIG="<config.h>")
+  include_directories(${TOP_SRC_DIR}/boost)
+  add_subdirectory(boost)
+endif()
+
 
-add_subdirectory(boost)
 if(NOT use_external_libintl)
-       add_subdirectory(intl)
+  add_subdirectory(intl)
 endif()
 add_subdirectory(src)