summaryrefslogtreecommitdiff
path: root/Modules/FindPNG.cmake
diff options
context:
space:
mode:
authorDavid Callu <callu.david@gmail.com>2019-11-28 12:15:20 +0100
committerDavid Callu <callu.david@gmail.com>2019-11-28 12:15:20 +0100
commitad41c98cbbdb535413feae41f17893ae3f3ac051 (patch)
tree494e3b18457ae30ea61ca24583ed3d716ea6a827 /Modules/FindPNG.cmake
parent7fe99b813c6772f056fddc2c6ea7f73ccb3d3e1c (diff)
downloadcmake-ad41c98cbbdb535413feae41f17893ae3f3ac051.tar.gz
FindPNG: add 'm' dependencies to static lib on Linux
Diffstat (limited to 'Modules/FindPNG.cmake')
-rw-r--r--Modules/FindPNG.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index bd400c74c7..f1fe89af1e 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"