]> git.lyx.org Git - features.git/blobdiff - CMakeLists.txt
msvc: always build 3rdparty libs
[features.git] / CMakeLists.txt
index e8b736111136142dee22da69fcd66758718db89f..2776d9dc09f521b42cf5f58dbf496cddde37422e 100644 (file)
@@ -139,6 +139,7 @@ LYX_OPTION(ENABLE_URLTESTS  "Enable for URL tests" OFF ALL)
 LYX_OPTION(ENABLE_EXPORT_TESTS "Enable for export tests" OFF ALL)
 LYX_OPTION(ASAN             "Use address sanitizer" OFF ALL)
 LYX_COMBO(USE_QT            "Use Qt version as frontend" QT4 QT5)
+LYX_OPTION(3RDPARTY_BUILD   "Build 3rdparty libs" OFF ALL)
 
 # GCC specific
 LYX_OPTION(PROFILE              "Build profile version" OFF GCC)
@@ -156,6 +157,7 @@ LYX_OPTION(VLD                   "Use VLD with MSVC" OFF MSVC)
 LYX_OPTION(WALL                  "Enable all warnings" OFF MSVC)
 LYX_OPTION(CONFIGURE_CHECKS      "Also run configure checks for MSVC" OFF MSVC)
 LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies for MSVC 10" OFF MSVC)
+LYX_OPTION(3RDPARTY_BUILD        "Build 3rdparty libraries " OFF MSVC)
 
 # APPLE specific
 LYX_OPTION(DMG                   "Build as Mac bundle, needed for .dmg  (experimental) " OFF MAC)
@@ -287,6 +289,9 @@ include(LyXPaths)
 file(STRINGS "${TOP_SRC_DIR}/configure.ac" _config_lines)
 
 if(WIN32)
+       if(MSVC)
+               set(LYX_3RDPARTY_BUILD ON)
+       endif()
        set(USE_WINDOWS_PACKAGING ON)
 elseif(APPLE)
        set(USE_MACOSX_PACKAGING ON)
@@ -611,16 +616,27 @@ include_directories(${TOP_BINARY_DIR} ${TOP_SRC_DIR}/src)
 set(Spelling_FOUND OFF)
 set(Include_used_spellchecker)   # String will be inserted into config.h
 
+if(LYX_3RDPARTY_BUILD)
+    add_subdirectory(3rdparty/hunspell)
+    add_definitions(-DHUNSPELL_STATIC)
+    set(HUNSPELL_FOUND ON)
+    message(STATUS "  * Hunspell:")
+    message(STATUS "     - include: ${HUNSPELL_INCLUDE_DIR}")
+    message(STATUS "     - library: ${HUNSPELL_LIBRARY}")
+endif()
+
 foreach(_spell "ASPELL" "Enchant" "Hunspell")
   string(TOUPPER ${_spell} _upspell)
-  find_package(${_spell})
+  if (NOT ${_upspell}_FOUND)
+    find_package(${_spell})
+  endif()
   if (${_upspell}_FOUND)
     include_directories(${${_upspell}_INCLUDE_DIR})
     set(Spelling_FOUND ON)
     message(STATUS "Building with USE_${_upspell}")
     set(Include_used_spellchecker "${Include_used_spellchecker}#define USE_${_upspell} 1\n")
   else()
-    if(LYX_${_upspell} AND NOT LYX_HUNSPELL)
+    if(LYX_${_upspell})
       message(FATAL_ERROR "Required ${_spell} devel package not found")
     else()
       message(STATUS "${_upspell} not found, building without ${_spell} support")
@@ -628,32 +644,25 @@ foreach(_spell "ASPELL" "Enchant" "Hunspell")
   endif()
 endforeach()
 
-if(LYX_HUNSPELL AND NOT HUNSPELL_FOUND)
-    add_subdirectory(src/3rdparty/hunspell)
-    set(Spelling_FOUND ON)
-endif()
-message(STATUS "  * Hunspell:")
-message(STATUS "     - include: ${HUNSPELL_INCLUDE_DIR}")
-message(STATUS "     - library: ${HUNSPELL_LIBRARY}")
-
+if(NOT LYX_PYTHON_EXECUTABLE)
+       find_package(PythonInterp 2.7 QUIET)
+       if(PYTHONINTERP_FOUND)
+         if(PYTHON_VERSION_STRING VERSION_GREATER 2.8)
+               unset(PYTHONINTERP_FOUND)
+         endif()
+       endif()
 
-find_package(PythonInterp 2.7 QUIET)
-if(PYTHONINTERP_FOUND)
-  if(PYTHON_VERSION_STRING VERSION_GREATER 2.8)
-    unset(PYTHONINTERP_FOUND)
-  endif()
-endif()
+       if(NOT PYTHONINTERP_FOUND AND NOT GNUWIN32_DIR)
+         unset(PYTHON_EXECUTABLE CACHE)
+         unset(PYTHON_VERSION_MAJOR)
+         unset(PYTHON_VERSION_MINOR)
+         unset(PYTHON_VERSION_STRING)
+         find_package(PythonInterp 3.3 REQUIRED)
+       endif()
 
-if (NOT PYTHONINTERP_FOUND)
-  unset(PYTHON_EXECUTABLE CACHE)
-  unset(PYTHON_VERSION_MAJOR)
-  unset(PYTHON_VERSION_MINOR)
-  unset(PYTHON_VERSION_STRING)
-  find_package(PythonInterp 3.3 REQUIRED)
+       set(LYX_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX")
 endif()
 
-set(LYX_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX")
-
 if(LYX_NLS)
        find_package(LyXGettext)
        if(LYX_PYTHON_EXECUTABLE AND GETTEXT_FOUND)
@@ -672,17 +681,14 @@ endif()
 if(UNIX)
     find_package(ICONV REQUIRED)
     find_package(ZLIB REQUIRED)
+else()
+    if(LYX_3RDPARTY_BUILD)
+       add_subdirectory(3rdparty/libiconv)
+       set(HAVE_ICONV_CONST 1)
+       add_subdirectory(3rdparty/zlib)
+    endif()
 endif()
 
-if(NOT ICONV_FOUND)
-    add_subdirectory(src/3rdparty/libiconv)
-endif()
-
-if(NOT ZLIB_FOUND)
-    add_subdirectory(src/3rdparty/zlib)
-endif()
-
-
 if(LYX_EXTERNAL_BOOST)
        message(STATUS "Searching for boost")
        if(LYX_USE_STD_REGEX)
@@ -712,8 +718,8 @@ else()
        endif()
        add_definitions(-DBOOST_USER_CONFIG="<config.h>")
        add_definitions(-DBOOST_SIGNALS_NO_DEPRECATION_WARNING=1)
-       include_directories(${TOP_SRC_DIR}/boost)
-       add_subdirectory(boost "${TOP_BINARY_DIR}/boost")
+       include_directories(${TOP_SRC_DIR}/3rdparty/boost)
+       add_subdirectory(3rdparty/boost "${TOP_BINARY_DIR}/3rdparty/boost")
 endif()