diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2021-04-30 19:47:47 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2021-04-30 19:47:47 +0200 |
| commit | a484541d4b6203d538f1a65db5a95e98f5bde920 (patch) | |
| tree | e2b33bd7f0da7e60d60cfd7fa5beeb55f40e3f50 /png | |
| parent | 2555e3b37e6218378e7becbb2b62ab6e7f1c1cd1 (diff) | |
CMake: improve detection and configuration of image libs
Also: fix old (pre 3.13) link_directories() usage
Diffstat (limited to 'png')
| -rw-r--r-- | png/CMakeLists.txt | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/png/CMakeLists.txt b/png/CMakeLists.txt index faf7062a9..a67c7eb0b 100644 --- a/png/CMakeLists.txt +++ b/png/CMakeLists.txt @@ -39,29 +39,32 @@ set(PNG_SRCS ) ####################################################################### -FL_ADD_LIBRARY(fltk_png STATIC "${PNG_SRCS}") -# install the png headers -install(FILES png.h;pngconf.h;pnglibconf.h - DESTINATION ${FLTK_INCLUDEDIR}/FL/images -) +# Build the static library +####################################################################### -if(OPTION_USE_SYSTEM_ZLIB) - target_link_libraries(fltk_png ${FLTK_ZLIB_LIBRARIES}) -else() - target_link_libraries(fltk_png fltk_z) -endif(OPTION_USE_SYSTEM_ZLIB) +FL_ADD_LIBRARY (fltk_png STATIC "${PNG_SRCS}") +target_link_libraries (fltk_png ${FLTK_ZLIB_LIBRARIES}) ####################################################################### -if(OPTION_BUILD_SHARED_LIBS) +# Build the shared library (optional) ####################################################################### -FL_ADD_LIBRARY(fltk_png SHARED "${PNG_SRCS}") -if(OPTION_USE_SYSTEM_ZLIB) - target_link_libraries(fltk_png_SHARED ${FLTK_ZLIB_LIBRARIES}) -else() - target_link_libraries(fltk_png_SHARED fltk_z_SHARED) -endif(OPTION_USE_SYSTEM_ZLIB) +if (OPTION_BUILD_SHARED_LIBS) + + FL_ADD_LIBRARY (fltk_png SHARED "${PNG_SRCS}") + + if (FLTK_USE_BUILTIN_ZLIB) + target_link_libraries (fltk_png_SHARED fltk_z_SHARED) + else() + target_link_libraries (fltk_png_SHARED ${FLTK_ZLIB_LIBRARIES}) + endif () + +endif () ####################################################################### -endif(OPTION_BUILD_SHARED_LIBS) +# Install the library headers ####################################################################### + +install (FILES png.h pngconf.h pnglibconf.h + DESTINATION ${FLTK_INCLUDEDIR}/FL/images +) |
