Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-04-21 11:58:01 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-04-21 13:01:27 +0300
commitc7a5c48cbad0062c55bf9fa6df2926646b2c3091 (patch)
treed53c082e2c1d58bea374017f435269ccc2892e7d /CMakeLists.txt
parent55a3d48046377444a3c36ffe7a6164030d447f6f (diff)
CMake: Add option to link against system-wide Gflags library
It is disabled by default, so should not affect existing configurations. Main benefits of this goes as: - Linux distros can use that to avoid libraries duplication and link blender package against gflags package from the system. - It it easier to test whether Blender works with updated version of Gflags prior to re-bundling the library.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt28
1 files changed, 22 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a91e1b655a..748ed649800 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -363,6 +363,10 @@ option(WITH_LIBMV "Enable Libmv structure from motion library" ON)
option(WITH_LIBMV_SCHUR_SPECIALIZATIONS "Enable fixed-size schur specializations." OFF)
mark_as_advanced(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
+# Logging/unbit test libraries.
+option(WITH_SYSTEM_GFLAGS "Use system-wide Gflags instead of a bundled one" OFF)
+mark_as_advanced(WITH_SYSTEM_GFLAGS)
+
# Freestyle
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
@@ -1317,15 +1321,27 @@ endif()
# Configure GLog/GFlags
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
+ if(WITH_SYSTEM_GFLAGS)
+ find_package(Gflags)
+ if(NOT GFLAGS_FOUND)
+ message(FATAL_ERROR "System wide Gflags is requested but was not found")
+ endif()
+ # FindGflags does not define this, and we are not even sure what to use here.
+ set(GFLAGS_DEFINES)
+ else()
+ set(GFLAGS_DEFINES
+ -DGFLAGS_DLL_DEFINE_FLAG=
+ -DGFLAGS_DLL_DECLARE_FLAG=
+ -DGFLAGS_DLL_DECL=
+ )
+ set(GFLAGS_NAMESPACE "gflags")
+ set(GFLAGS_LIBRARIES extern_gflags)
+ set(GFLAGS_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/extern/gflags/src")
+ endif()
+
set(GLOG_DEFINES
-DGOOGLE_GLOG_DLL_DECL=
)
-
- set(GFLAGS_DEFINES
- -DGFLAGS_DLL_DEFINE_FLAG=
- -DGFLAGS_DLL_DECLARE_FLAG=
- -DGFLAGS_DLL_DECL=
- )
endif()
#-----------------------------------------------------------------------------