[Cmake-commits] CMake branch, next, updated. v3.7.2-1327-g01d6480
Brad King
brad.king at kitware.com
Mon Feb 6 16:14:12 EST 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 01d648002dd3d669c4612e8174671c27bd637702 (commit)
via a3f71349deaf533201d3cb2e8076bb4e7edfbbf6 (commit)
from 30c8c9bc75b387b1432a9c1cb5d4399bae163a71 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=01d648002dd3d669c4612e8174671c27bd637702
commit 01d648002dd3d669c4612e8174671c27bd637702
Merge: 30c8c9b a3f7134
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Feb 6 16:14:08 2017 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Feb 6 16:14:08 2017 -0500
Merge topic 'FindProtobuf-static-libs' into next
a3f71349 FindProtobuf: Add option to find static libraries on UNIX
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a3f71349deaf533201d3cb2e8076bb4e7edfbbf6
commit a3f71349deaf533201d3cb2e8076bb4e7edfbbf6
Author: Sébastien GALLOU <sebastien.gallou at xerox.com>
AuthorDate: Mon Feb 6 17:39:59 2017 +0100
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Feb 6 16:12:39 2017 -0500
FindProtobuf: Add option to find static libraries on UNIX
Add a `Protobuf_USE_STATIC_LIBS` input variable to optionally restrict
searches to static library names. This follows the approach of
`FindBoost`.
diff --git a/Help/release/dev/FindProtobuf-static-libs.rst b/Help/release/dev/FindProtobuf-static-libs.rst
new file mode 100644
index 0000000..fcc0678
--- /dev/null
+++ b/Help/release/dev/FindProtobuf-static-libs.rst
@@ -0,0 +1,5 @@
+FindProtobuf-static-libs
+------------------------
+
+* The :module:`FindProtobuf` module now supports usage of static libraries
+ for Unix via a new ``Protobuf_USE_STATIC_LIBS`` input variable.
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 3ffd5a7..102ed42 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -20,6 +20,9 @@
# imported .proto files.
# ``Protobuf_DEBUG``
# Show debug messages.
+# ``Protobuf_USE_STATIC_LIBS``
+# Set to ON to force the use of the static libraries.
+# Default is OFF.
#
# Defines the following variables:
#
@@ -218,6 +221,14 @@ function(PROTOBUF_GENERATE_PYTHON SRCS)
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
endfunction()
+
+if(Protobuf_DEBUG)
+ # Output some of their choices
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Protobuf_USE_STATIC_LIBS = ${Protobuf_USE_STATIC_LIBS}")
+endif()
+
+
# Backwards compatibility
# Define camel case versions of input variables
foreach(UPPER
@@ -245,6 +256,17 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_PROTOBUF_ARCH_DIR x64/)
endif()
+
+# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
+if( Protobuf_USE_STATIC_LIBS )
+ set( _protobuf_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ if(WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ else()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
+ endif()
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
# Internal function: search for normal library as well as a debug one
@@ -399,6 +421,11 @@ if(Protobuf_FOUND)
set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIR})
endif()
+# Restore the original find library ordering
+if( Protobuf_USE_STATIC_LIBS )
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${_protobuf_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+endif()
+
# Backwards compatibility
# Define upper case versions of output variables
foreach(Camel
-----------------------------------------------------------------------
Summary of changes:
Help/release/dev/FindProtobuf-static-libs.rst | 5 +++++
Modules/FindProtobuf.cmake | 27 +++++++++++++++++++++++++
2 files changed, 32 insertions(+)
create mode 100644 Help/release/dev/FindProtobuf-static-libs.rst
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list