vcpkg/ports/nana/fix-linking.patch
2017-05-05 11:45:04 +02:00

52 lines
1.8 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c9c9c9..ae35185 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -149,26 +149,20 @@ endif ()
# Find PNG
if(NANA_CMAKE_ENABLE_PNG)
add_definitions(-DNANA_ENABLE_PNG)
- set(NANA_LINKS "${NANA_LINKS} -lpng")
if(NANA_CMAKE_LIBPNG_FROM_OS)
- find_package(PNG)
- if (PNG_FOUND)
- include_directories( ${PNG_INCLUDE_DIRS})
- add_definitions(-DUSE_LIBPNG_FROM_OS)
- endif(PNG_FOUND)
+ find_package(PNG REQUIRED)
+ include_directories(${PNG_INCLUDE_DIRS})
+ add_definitions(-DUSE_LIBPNG_FROM_OS)
endif(NANA_CMAKE_LIBPNG_FROM_OS)
endif(NANA_CMAKE_ENABLE_PNG)
# Find JPEG
if(NANA_CMAKE_ENABLE_JPEG)
add_definitions(-DNANA_ENABLE_JPEG)
- set(NANA_LINKS "${NANA_LINKS} -ljpeg")
if(NANA_CMAKE_LIBJPEG_FROM_OS)
- find_package(JPEG)
- if (JPEG_FOUND)
- include_directories( ${JPEG_INCLUDE_DIRS})
- add_definitions(-DUSE_LIBJPEG_FROM_OS)
- endif(JPEG_FOUND)
+ find_package(JPEG REQUIRED)
+ include_directories(${JPEG_INCLUDE_DIRS})
+ add_definitions(-DUSE_LIBJPEG_FROM_OS)
endif(NANA_CMAKE_LIBJPEG_FROM_OS)
endif(NANA_CMAKE_ENABLE_JPEG)
@@ -253,7 +247,12 @@ endforeach(subdir ${NANA_SOURCE_SUBDIRS})
include_directories(${NANA_INCLUDE_DIR})
add_library(${PROJECT_NAME} ${sources} )
-target_link_libraries(${PROJECT_NAME} ${NANA_LINKS})
+if(NANA_CMAKE_ENABLE_JPEG AND NANA_CMAKE_LIBJPEG_FROM_OS)
+ target_link_libraries(${PROJECT_NAME} ${JPEG_LIBRARIES})
+endif()
+if(NANA_CMAKE_ENABLE_PNG AND NANA_CMAKE_LIBPNG_FROM_OS)
+ target_link_libraries(${PROJECT_NAME} ${PNG_LIBRARIES})
+endif()
# Headers: use INCLUDE_DIRECTORIES
# Libraries: use FIND_LIBRARY and link with the result of it (try to avoid LINK_DIRECTORIES)