simplify CMakeList with cmake scripts

This commit is contained in:
qPCR4vir
2018-09-10 14:27:56 +02:00
parent 8057bf95e1
commit 8c6b0d4653
7 changed files with 149 additions and 147 deletions

View File

@@ -0,0 +1,17 @@
option(NANA_CMAKE_ENABLE_PNG "Enable the use of PNG" OFF)
option(NANA_CMAKE_LIBPNG_FROM_OS "Use libpng from operating system." ON)
# todo: decide - PUBLIC vs PRIVATE
if(NANA_CMAKE_ENABLE_PNG)
if(NANA_CMAKE_LIBPNG_FROM_OS)
find_package(PNG)
if(PNG_FOUND)
target_include_directories(nana PUBLIC ${PNG_INCLUDE_DIRS})
target_compile_options (nana PUBLIC ${PNG_LIBRARIES})
target_compile_definitions(nana PUBLIC NANA_ENABLE_PNG USE_LIBPNG_FROM_OS)
endif()
else()
target_compile_definitions(nana PUBLIC NANA_ENABLE_PNG)
endif()
endif()