Don't use our copy of libpng header files when USE_SHARED_LIBPNG is ON

This commit is contained in:
David Capello 2015-06-09 10:20:56 -03:00
parent 65d03c9893
commit b2fb33a415
2 changed files with 21 additions and 18 deletions

View File

@ -112,14 +112,6 @@ set(SIMPLEINI_DIR ${CMAKE_SOURCE_DIR}/third_party/simpleini)
set(TINYXML_DIR ${CMAKE_SOURCE_DIR}/third_party/tinyxml)
set(ZLIB_DIR ${CMAKE_SOURCE_DIR}/third_party/zlib)
# Zlib generated zconf.h file
include_directories(${CMAKE_BINARY_DIR}/third_party/zlib)
# We need private libpng header files so it doesn't matter if we use
# the shared version of libpng or not, we need to find header files in
# "third_party/libpng"" directory.
include_directories(${LIBPNG_DIR})
# Search in the "cmake" directory for additional CMake modules.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
@ -127,10 +119,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
######################################################################
# Common definitions to compile all sources
# Do not use MMX optimizations in PNG code
add_definitions(-DPNG_NO_MMX_CODE)
# Common definitions to compile all sources (app code and third party)
# Debug C/C++ flags
if(CMAKE_BUILD_TYPE STREQUAL Debug)
@ -150,6 +139,25 @@ if(NOT USE_SHARED_CURL)
set(CURL_STATICLIB ON BOOL)
endif()
if(NOT USE_SHARED_ZLIB)
# Zlib generated zconf.h file
include_directories(${CMAKE_BINARY_DIR}/third_party/zlib)
endif()
if(USE_SHARED_LIBPNG)
find_package(PNG)
if(NOT PNG_FOUND)
message(FATAL_ERROR "libpng not found")
endif()
add_definitions(${PNG_DEFINITIONS})
include_directories(${PNG_INCLUDE_DIR})
else()
include_directories(${LIBPNG_DIR})
endif()
# Do not use MMX optimizations in PNG code
add_definitions(-DPNG_NO_MMX_CODE)
######################################################################
# Allegro 4 backend

View File

@ -86,12 +86,7 @@ else()
endif()
if(USE_SHARED_LIBPNG)
find_package(PNG)
if(PNG_FOUND)
set(libs3rdparty ${libs3rdparty} ${PNG_LIBRARIES})
add_definitions(${PNG_DEFINITIONS})
include_directories(${PNG_INCLUDE_DIR})
endif(PNG_FOUND)
set(libs3rdparty ${libs3rdparty} ${PNG_LIBRARIES})
else()
set(libs3rdparty ${libs3rdparty} libpng)
endif()