make libpng only selectable when using png

This commit is contained in:
Robert Hauck 2015-02-11 14:02:55 +01:00
parent 0464e8e5d7
commit 0fa61b0c95

View File

@ -15,18 +15,20 @@ endif()
option(NANA_ENABLE_PNG "Enable the use of PNG" ON) option(NANA_ENABLE_PNG "Enable the use of PNG" ON)
if(NANA_ENABLE_PNG) if(NANA_ENABLE_PNG)
add_definitions(-DNANA_ENABLE_PNG) add_definitions(-DNANA_ENABLE_PNG)
endif()
option(NANA_LIBPNG "Use the included libpng" ON) option(NANA_LIBPNG "Use the included libpng" ON)
if(NANA_LIBPNG) if(NANA_LIBPNG)
add_definitions(-DNANA_LIBPNG) add_definitions(-DNANA_LIBPNG)
else() else()
find_package(PNG) find_package(PNG)
if (PNG_FOUND) if (PNG_FOUND)
include_directories( ${PNG_INCLUDE_DIRS}) include_directories( ${PNG_INCLUDE_DIRS})
endif()
endif() endif()
endif() endif()
#copy our new config.hpp (with removed PNG defines) #copy our new config.hpp (with removed PNG defines)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/build/cmake/config.hpp ${CMAKE_SOURCE_DIR}/include/nana/) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/build/cmake/config.hpp ${CMAKE_SOURCE_DIR}/include/nana/)