summaryrefslogtreecommitdiff
path: root/Modules/FindJPEG.cmake
diff options
context:
space:
mode:
authorMateusz Loskot <mateusz@loskot.net>2018-04-17 23:26:44 +0200
committerMateusz Loskot <mateusz@loskot.net>2018-04-17 23:26:44 +0200
commit13952a3b7fb930baeeda299bf186e29d57d794fe (patch)
treee2d518abcba507174e3d35b4e67195428626fe02 /Modules/FindJPEG.cmake
parent1f6649b7d118e9de2a51c9e48b5fea527f608fc1 (diff)
downloadcmake-13952a3b7fb930baeeda299bf186e29d57d794fe.tar.gz
FindJPEG: Add multi config support and associated docs
Diffstat (limited to 'Modules/FindJPEG.cmake')
-rw-r--r--Modules/FindJPEG.cmake24
1 files changed, 22 insertions, 2 deletions
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index 9c047e57de..fa4f3a156a 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -28,13 +28,33 @@
#
# ``JPEG_INCLUDE_DIR``
# where to find jpeglib.h, etc.
+# ``JPEG_LIBRARY_RELEASE``
+# where to find the JPEG library (optimized).
+# ``JPEG_LIBRARY_DEBUG``
+# where to find the JPEG library (debug).
+#
+# Obsolete variables
+# ^^^^^^^^^^^^^^^^^^
+#
# ``JPEG_LIBRARY``
# where to find the JPEG library.
find_path(JPEG_INCLUDE_DIR jpeglib.h)
-set(JPEG_NAMES ${JPEG_NAMES} jpeg libjpeg)
-find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES})
+set(jpeg_names ${JPEG_NAMES} jpeg libjpeg)
+foreach(name ${JPEG_NAMES})
+ list(APPEND jpeg_names_debug "${name}d")
+endforeach()
+
+if(NOT JPEG_LIBRARY)
+ find_library(JPEG_LIBRARY_RELEASE NAMES ${jpeg_names})
+ find_library(JPEG_LIBRARY_DEBUG NAMES ${jpeg_names_debug})
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(JPEG)
+ mark_as_advanced(JPEG_LIBRARY_RELEASE JPEG_LIBRARY_DEBUG)
+endif()
+unset(jpeg_names)
+unset(jpeg_names_debug)
if(JPEG_INCLUDE_DIR AND EXISTS "${JPEG_INCLUDE_DIR}/jpeglib.h")
file(STRINGS "${JPEG_INCLUDE_DIR}/jpeglib.h"