[Cmake-commits] CMake branch, next, updated. v3.3.1-2728-g38a3118
Brad King
brad.king at kitware.com
Wed Sep 2 11:39:33 EDT 2015
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 38a311861de628be8789a388377c3b2c0853ab7e (commit)
via 11097f52311f5605c545e9ca4a25ee03a811d523 (commit)
from dfca023503108d992e4ca4ba5fff5e325d2d56f9 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=38a311861de628be8789a388377c3b2c0853ab7e
commit 38a311861de628be8789a388377c3b2c0853ab7e
Merge: dfca023 11097f5
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 2 11:39:32 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Sep 2 11:39:32 2015 -0400
Merge topic 'FindZLIB-per-config' into next
11097f52 FindZLIB: Find debug and release variants separately
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11097f52311f5605c545e9ca4a25ee03a811d523
commit 11097f52311f5605c545e9ca4a25ee03a811d523
Author: Michael Scott <michael.scott250 at gmail.com>
AuthorDate: Tue Sep 1 20:41:27 2015 +0100
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 2 11:35:43 2015 -0400
FindZLIB: Find debug and release variants separately
Provide each variant in ZLIB_LIBRARIES and ZLIB::ZLIB imported location
properties when one is found, while maintaining support for manually
setting the library via ZLIB_LIBRARY.
diff --git a/Help/release/dev/FindZLIB-per-config.rst b/Help/release/dev/FindZLIB-per-config.rst
new file mode 100644
index 0000000..97fd6ef
--- /dev/null
+++ b/Help/release/dev/FindZLIB-per-config.rst
@@ -0,0 +1,5 @@
+FindZLIB-per-config
+-------------------
+
+* The :module:`FindZLIB` module learned to search separately for
+ debug and release variants.
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index d4a27d5..a57f450 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -74,14 +74,28 @@ set(_ZLIB_SEARCH_NORMAL
)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
-set(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1)
+set(ZLIB_NAMES z zlib zdll zlib1)
+set(ZLIB_NAMES_DEBUG zlibd zlibd1)
# Try each search configuration.
foreach(search ${_ZLIB_SEARCHES})
- find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
- find_library(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib)
+ find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
endforeach()
+# Allow ZLIB_LIBRARY to be set manually, as the location of the zlib library
+if(NOT ZLIB_LIBRARY)
+ foreach(search ${_ZLIB_SEARCHES})
+ find_library(ZLIB_LIBRARY_RELEASE NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib)
+ find_library(ZLIB_LIBRARY_DEBUG NAMES ${ZLIB_NAMES_DEBUG} ${${search}} PATH_SUFFIXES lib)
+ endforeach()
+
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(ZLIB)
+endif()
+
+unset(ZLIB_NAMES)
+unset(ZLIB_NAMES_DEBUG)
+
mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
@@ -112,12 +126,33 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D
if(ZLIB_FOUND)
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
- set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
+
+ if(NOT ZLIB_LIBRARIES)
+ set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
+ endif()
if(NOT TARGET ZLIB::ZLIB)
add_library(ZLIB::ZLIB UNKNOWN IMPORTED)
set_target_properties(ZLIB::ZLIB PROPERTIES
- IMPORTED_LOCATION "${ZLIB_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}")
+
+ if(ZLIB_LIBRARY_RELEASE)
+ set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(ZLIB::ZLIB PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${ZLIB_LIBRARY_RELEASE}")
+ endif()
+
+ if(ZLIB_LIBRARY_DEBUG)
+ set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(ZLIB::ZLIB PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${ZLIB_LIBRARY_DEBUG}")
+ endif()
+
+ if(NOT ZLIB_LIBRARY_RELEASE AND NOT ZLIB_LIBRARY_DEBUG)
+ set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
+ IMPORTED_LOCATION "${ZLIB_LIBRARY}")
+ endif()
endif()
endif()
-----------------------------------------------------------------------
Summary of changes:
Help/release/dev/FindZLIB-per-config.rst | 5 ++++
Modules/FindZLIB.cmake | 45 ++++++++++++++++++++++++++----
2 files changed, 45 insertions(+), 5 deletions(-)
create mode 100644 Help/release/dev/FindZLIB-per-config.rst
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list