diff --git a/CMakeLists.txt b/CMakeLists.txt index ca83ea668..dda4867a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,7 @@ OPTION(FREECAD_BUILD_FEM "Build the FreeCAD FEM module, be aware, unfinished cod OPTION(FREECAD_BUILD_SANDBOX "Build the FreeCAD Sandbox module which is only for testing purposes" OFF) OPTION(FREECAD_BUILD_TEMPLATE "Build the FreeCAD template module which is only for testing purposes" OFF) OPTION(FREECAD_BUILD_DEBIAN "Prepare for a build of a Debian package" OFF) +OPTION(USE_EXTERNAL_ZIPIOS "Use system installed zipios++ instead of the bundled." OFF) # ============================================================================== diff --git a/src/Base/CMakeLists.txt b/src/Base/CMakeLists.txt index 21f91d3ca..fdfb8a2b1 100644 --- a/src/Base/CMakeLists.txt +++ b/src/Base/CMakeLists.txt @@ -281,7 +281,6 @@ SET(FreeCADBase_HPP_SRCS ) SET(FreeCADBase_SRCS - ${zipios_SRCS} ${pycxx_SRCS} ${FreeCADBase_CPP_SRCS} ${FreeCADBase_HPP_SRCS} @@ -293,6 +292,27 @@ SET(FreeCADBase_SRCS PreCompiled.h ) +# Use external zipios++ if specified. +if(USE_EXTERNAL_ZIPIOS) + find_library(ZIPIOS_LIBRARY zipios) + find_path(ZIPIOS_INCLUDES zipios++/zipios-config.h) + if(ZIPIOS_LIBRARY) + message(STATUS "Found zipios++: ${ZIPIOS}") + endif() + if(ZIPIOS_INCLUDES) + message(STATUS "Found zipios++ headers.") + endif() + if(ZIPIOS_LIBRARY AND ZIPIOS_INCLUDES) + list(APPEND FreeCADBase_LIBS ${ZIPIOS_LIBRARY}) + include_directories(${ZIPIOS_INCLUDES}) + else() + message(FATAL_ERROR "Using external zipios++ was specified but was not found.") + endif() +else(USE_EXTERNAL_ZIPIOS) + list(APPEND FreeCADBase_SRCS ${zipios_SRCS}) +endif(USE_EXTERNAL_ZIPIOS) + + if(MSVC) add_definitions(-D_PreComp_) ADD_MSVC_PRECOMPILED_HEADER("PreCompiled.h" "PreCompiled.cpp" FreeCADBase_CPP_SRCS)