diff options
author | David Callu <callu.david@gmail.com> | 2019-11-28 11:15:20 (GMT) |
---|---|---|
committer | David Callu <callu.david@gmail.com> | 2019-11-28 11:15:20 (GMT) |
commit | ad41c98cbbdb535413feae41f17893ae3f3ac051 (patch) | |
tree | 494e3b18457ae30ea61ca24583ed3d716ea6a827 /Modules/FindPNG.cmake | |
parent | 7fe99b813c6772f056fddc2c6ea7f73ccb3d3e1c (diff) | |
download | CMake-ad41c98cbbdb535413feae41f17893ae3f3ac051.zip CMake-ad41c98cbbdb535413feae41f17893ae3f3ac051.tar.gz CMake-ad41c98cbbdb535413feae41f17893ae3f3ac051.tar.bz2 |
FindPNG: add 'm' dependencies to static lib on Linux
Diffstat (limited to 'Modules/FindPNG.cmake')
-rw-r--r-- | Modules/FindPNG.cmake | 10 |
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" |