Skip to content

Commit

Permalink
Fix cmake build, make sure custom zlib and custom libpng settings are…
Browse files Browse the repository at this point in the history
… used
  • Loading branch information
fhanau committed Mar 18, 2020
1 parent ce388e7 commit b748675
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ add_subdirectory(lodepng EXCLUDE_FROM_ALL)
add_subdirectory(miniz EXCLUDE_FROM_ALL)
add_subdirectory(zlib EXCLUDE_FROM_ALL)
add_subdirectory(zopfli EXCLUDE_FROM_ALL)
file(COPY ${CMAKE_SOURCE_DIR}/pngusr.h DESTINATION ${CMAKE_SOURCE_DIR}/libpng/)
add_subdirectory(optipng EXCLUDE_FROM_ALL)
# Mozjpeg changes the install prefix if it thinks the current is defaulted
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
Expand Down
6 changes: 6 additions & 0 deletions src/optipng/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ add_library(optipng

add_library(optipng::optipng ALIAS optipng)

#make sure that we are using custom zlib and custom libpng options
set(PNG_BUILD_ZLIB ON CACHE BOOL "use custom zlib within libpng" FORCE)
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../zlib/ CACHE FILEPATH "custom zlib directory" FORCE)
add_compile_options(-Wno-macro-redefined)
add_compile_definitions(PNG_USER_CONFIG)

add_subdirectory(../libpng libpng EXCLUDE_FROM_ALL)
target_link_libraries(optipng
png_static)
Expand Down

0 comments on commit b748675

Please sign in to comment.