diff options
-rw-r--r-- | libpng/CMakeLists.txt | 16 | ||||
-rw-r--r-- | zlib/CMakeLists.txt | 4 |
2 files changed, 7 insertions, 13 deletions
diff --git a/libpng/CMakeLists.txt b/libpng/CMakeLists.txt index 2ee5bf3..490e7d3 100644 --- a/libpng/CMakeLists.txt +++ b/libpng/CMakeLists.txt @@ -37,10 +37,6 @@ set(PNGLIB_RELEASE 1) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) -# needed packages -find_package(ZLIB REQUIRED) -include_directories(${ZLIB_INCLUDE_DIR}) - if(NOT WIN32) find_library(M_LIBRARY NAMES m @@ -182,7 +178,7 @@ if(NOT M_LIBRARY AND NOT WIN32) endif() # NOW BUILD OUR TARGET -include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) if(PNG_SHARED) add_library(${PNG_LIB_NAME} SHARED ${libpng_sources}) @@ -191,7 +187,7 @@ if(PNG_SHARED) set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib") set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib") endif() - target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY}) + target_link_libraries(${PNG_LIB_NAME} Zlib::zlib ${M_LIBRARY}) endif() if(PNG_STATIC) @@ -202,7 +198,7 @@ if(PNG_STATIC) # msvc does not append 'lib' - do it here to have consistent name set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib") endif() - target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY}) + target_link_libraries(${PNG_LIB_NAME_STATIC} Zlib::zlib ${M_LIBRARY}) endif() @@ -384,12 +380,6 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) DESTINATION bin) endif() -# On versions of CMake that support it, create an export file CMake -# users can include() to import our targets -if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL ) - install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake) -endif() - # what's with libpng-$VER%.txt and all the extra files? diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt index 0fe939d..312f0ee 100644 --- a/zlib/CMakeLists.txt +++ b/zlib/CMakeLists.txt @@ -187,6 +187,10 @@ add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) set_target_properties(zlib PROPERTIES SOVERSION 1) +target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) +target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) +add_library(Zlib::zlib ALIAS zlib) +add_library(Zlib::zlibstatic ALIAS zlibstatic) if(NOT CYGWIN) # This property causes shared libraries on Linux to have the full version |