From fddd7f518316d778f93b2fc861c85c43366bc206 Mon Sep 17 00:00:00 2001 From: Jorma Date: Wed, 17 Oct 2018 20:44:33 +0300 Subject: [PATCH] Fixed LIBRARY_TYPE in CMakeLists.txt Fixed LIBRARY_TYPE in CMakeLists.txt, this allows to properly control STATIC and SHARED library builds. --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15bbbf7de..33bb4ccb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,13 @@ if ( PNG_DEBUG ) endif ( ) include_directories ( ${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR} ) -add_library ( ${PNG_LIB_NAME} ${libpng_sources} ) +if(PNG_SHARED) + set(LIBRARY_TYPE SHARED) +else() + set(LIBRARY_TYPE STATIC) +endif() + +add_library ( ${PNG_LIB_NAME} ${LIBRARY_TYPE} ${libpng_sources} ) target_link_libraries ( ${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY} ) if ( PNG_SHARED AND WIN32 )