summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAndreas Schuh <andreas.schuh.84@gmail.com>2015-03-24 18:55:17 +0000
committerAndreas Schuh <andreas.schuh.84@gmail.com>2015-03-24 18:55:17 +0000
commit9e937e80fb1760b0fa893a6e0ec401f9a5bc7946 (patch)
treefc9fe207add1676e15f06f6f3170f1bfd0eb955a /cmake
parenta9b983a827e530cab88639b3ce105f8d2cb2fdde (diff)
downloadgflags-9e937e80fb1760b0fa893a6e0ec401f9a5bc7946.tar.gz
gflags-9e937e80fb1760b0fa893a6e0ec401f9a5bc7946.tar.bz2
gflags-9e937e80fb1760b0fa893a6e0ec401f9a5bc7946.zip
#105 Add gflags_SHARED and gflags_NOTHREADED gflags-config.cmake options
Diffstat (limited to 'cmake')
-rw-r--r--cmake/config.cmake.in36
1 files changed, 34 insertions, 2 deletions
diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in
index ee8a916..d75be46 100644
--- a/cmake/config.cmake.in
+++ b/cmake/config.cmake.in
@@ -20,8 +20,40 @@ get_filename_component (_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_PREF
# manually to the include search path for targets which link to gflags.
set (@PACKAGE_NAME@_INCLUDE_DIR "${_INSTALL_PREFIX}/@INCLUDE_INSTALL_DIR@")
-# gflags library
-set (@PACKAGE_NAME@_LIBRARIES gflags)
+# default settings
+if (NOT DEFINED @PACKAGE_NAME@_SHARED)
+ if (TARGET @PACKAGE_NAME@-static OR TARGET @PACKAGE_NAME@_nothreads-static)
+ set (@PACKAGE_NAME@_SHARED FALSE)
+ else ()
+ set (@PACKAGE_NAME@_SHARED TRUE)
+ endif ()
+endif ()
+if (NOT DEFINED @PACKAGE_NAME@_NOTHREADS)
+ if (TARGET @PACKAGE_NAME@-static OR TARGET @PACKAGE_NAME@-shared)
+ set (@PACKAGE_NAME@_NOTHREADS FALSE)
+ else ()
+ set (@PACKAGE_NAME@_NOTHREADS TRUE)
+ endif ()
+endif ()
+
+# choose imported library target
+if (@PACKAGE_NAME@_SHARED)
+ if (@PACKAGE_NAME@_NOTHREADS)
+ set (@PACKAGE_NAME@_LIBRARIES @PACKAGE_NAME@_nothreads-shared)
+ else ()
+ set (@PACKAGE_NAME@_LIBRARIES @PACKAGE_NAME@-shared)
+ endif ()
+else ()
+ if (@PACKAGE_NAME@_NOTHREADS)
+ set (@PACKAGE_NAME@_LIBRARIES @PACKAGE_NAME@_nothreads-static)
+ else ()
+ set (@PACKAGE_NAME@_LIBRARIES @PACKAGE_NAME@-static)
+ endif ()
+endif ()
+if (NOT TARGET ${@PACKAGE_NAME@_LIBRARIES})
+ message (FATAL_ERROR "Your @PACKAGE_NAME@ installation does not contain a ${@PACKAGE_NAME@_LIBRARIES} library!"
+ " Try a different combination of @PACKAGE_NAME@_SHARED and @PACKAGE_NAME@_NOTHREADS.")
+endif ()
# unset private variables
unset (_INSTALL_PREFIX)