summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-12-05 16:42:23 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-12-05 16:42:33 (GMT)
commit632bd60515aa5dce1cf5c06e97f8a2321ee217be (patch)
treec5180457052c48accb43e6c2b17b8e3faa28fd90 /Modules
parent3eb3fde9ed0575d7ef2fe703e3aa16203ec86daa (diff)
parentad41c98cbbdb535413feae41f17893ae3f3ac051 (diff)
downloadCMake-632bd60515aa5dce1cf5c06e97f8a2321ee217be.zip
CMake-632bd60515aa5dce1cf5c06e97f8a2321ee217be.tar.gz
CMake-632bd60515aa5dce1cf5c06e97f8a2321ee217be.tar.bz2
Merge topic 'FindPNG-static-dep-m'
ad41c98cbb FindPNG: add 'm' dependencies to static lib on Linux Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4096
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindPNG.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index bd400c7..f1fe89a 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -94,6 +94,10 @@ if(ZLIB_FOUND)
set(PNG_INCLUDE_DIRS ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS} ) # for backward compatibility
set(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
+ if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND
+ ("${PNG_LIBRARY}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$"))
+ list(APPEND PNG_LIBRARIES m)
+ endif()
if (CYGWIN)
if(BUILD_SHARED_LIBS)
@@ -110,6 +114,12 @@ if(ZLIB_FOUND)
INTERFACE_COMPILE_DEFINITIONS "${_PNG_COMPILE_DEFINITIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${PNG_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
+ if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND
+ ("${PNG_LIBRARY}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$"))
+ set_property(TARGET PNG::PNG APPEND PROPERTY
+ INTERFACE_LINK_LIBRARIES m)
+ endif()
+
if(EXISTS "${PNG_LIBRARY}")
set_target_properties(PNG::PNG PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"