Skip to content

Commit

Permalink
cmake: Add an option to enable/disable building of executables
Browse files Browse the repository at this point in the history
Add the CMake option PNG_EXECUTABLES (on by default) in order to
allow or disallow the building of non-essential executable programs
associated with libpng.

Contributed-by: Alex Gaynor <[email protected]>
Contributed-by: Cosmin Truta <[email protected]>
Signed-off-by: Cosmin Truta <[email protected]>
  • Loading branch information
alex authored and ctruta committed May 18, 2020
1 parent 87378bc commit 28c0f88
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# Revised by David Callu, 2020
# Revised by Steve Robinson, 2020
# Revised by Simon Hausmann, 2020
# Revised by Alex Gaynor, 2020

# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
Expand Down Expand Up @@ -56,7 +57,8 @@ endif()
# COMMAND LINE OPTIONS
option(PNG_SHARED "Build shared lib" ON)
option(PNG_STATIC "Build static lib" ON)
option(PNG_TESTS "Build libpng tests" ON)
option(PNG_EXECUTABLES "Build libpng executables" ON)
option(PNG_TESTS "Build libpng tests" ON)

# Many more configuration options could be added here
option(PNG_FRAMEWORK "Build OS X framework" OFF)
Expand Down Expand Up @@ -750,7 +752,7 @@ if(PNG_TESTS AND PNG_SHARED)
png_add_test(NAME pngimage-full COMMAND pngimage OPTIONS --exhaustive --list-combos --log FILES ${PNGSUITE_PNGS})
endif()

if(PNG_SHARED)
if(PNG_SHARED AND PNG_EXECUTABLES)
add_executable(pngfix ${pngfix_sources})
target_link_libraries(pngfix png)
set(PNG_BIN_TARGETS pngfix)
Expand Down

0 comments on commit 28c0f88

Please sign in to comment.