commit a51847f33f06087f5ead9897336c8997014fa8ef
Author: Kornel Benko <[email protected]>
Date:   Tue Jul 5 15:57:04 2016 +0200

    Cmake build: Split use of 3RDPARTY_BUILD to build individual libs
    
    The split is now analogous to automake. The individual libs are handled
    analogously to already handled boost.
    automake config setting                     cmake config settings
    --with-included-iconv                       -DLYX_EXTERNAL_ICONV=OFF
    --with-included-zlib                        -DLYX_EXTERNAL_Z=OFF
    --with--included-hunspell           -DLYX_EXTERNAL_HUNSPELL=OFF
---
 CMakeLists.txt |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c9ab63..76cbdde 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -141,7 +141,10 @@ 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)
+#LYX_OPTION(3RDPARTY_BUILD   "Build 3rdparty libs" OFF ALL)
+LYX_OPTION(EXTERNAL_Z       "Build 3rdparty lib zlib" ON ALL)
+LYX_OPTION(EXTERNAL_ICONV   "Build 3rdparty lib iconvlib" ON ALL)
+LYX_OPTION(EXTERNAL_HUNSPELL "Build 3rdparty lib hunspelllib" ON ALL)
 
 # GCC specific
 LYX_OPTION(PROFILE              "Build profile version" OFF GCC)
@@ -207,7 +210,6 @@ else()
        set(LYX_MERGE_REBUILD OFF)
 endif()
 
-
 if(LYX_DEPENDENCIES_DOWNLOAD)
        message(STATUS)
        if(MSVC14)
@@ -312,6 +314,14 @@ else()
        set(USE_POSIX_PACKAGING ON)
 endif()
 
+if(LYX_3RDPARTY_BUILD)
+  # LYX_3RDPARTY_BUILD is not cached anymore, but for compatibility reasons
+  # this enables the build of all 3rd_party libs
+  set(LYX_EXTERNAL_Z        OFF CACHE BOOL "Build 3rdparty lib zlib"    FORCE)
+  set(LYX_EXTERNAL_ICONV    OFF CACHE BOOL "Build 3rdparty iconvlib"    FORCE)
+  set(LYX_EXTERNAL_HUNSPELL OFF CACHE BOOL "Build 3rdparty hunspelllib" FORCE)
+endif()
+
 macro(setstripped _varname)
        if(${ARGC} GREATER 1)
                string(STRIP "${ARGV1}" _v)
@@ -642,7 +652,7 @@ 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)
+if(NOT LYX_EXTERNAL_HUNSPELL)
     add_subdirectory(3rdparty/hunspell)
     add_definitions(-DHUNSPELL_STATIC)
     set(HUNSPELL_FOUND ON)
@@ -706,13 +716,17 @@ if(LYX_NLS)
        endif()
 endif()
 
-if(LYX_3RDPARTY_BUILD)
-       add_subdirectory(3rdparty/libiconv)
-       set(HAVE_ICONV_CONST 1)
-       add_subdirectory(3rdparty/zlib)
+if(LYX_EXTERNAL_ICONV)
+  find_package(ICONV REQUIRED)
+else()
+  add_subdirectory(3rdparty/libiconv)
+  set(HAVE_ICONV_CONST 1)
+endif()
+
+if(LYX_EXTERNAL_Z)
+  find_package(ZLIB REQUIRED)
 else()
-       find_package(ICONV REQUIRED)
-       find_package(ZLIB REQUIRED)
+  add_subdirectory(3rdparty/zlib)
 endif()
 
 if(LYX_EXTERNAL_BOOST)

Reply via email to