CMakeLists.txt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #
  2. # Copyright (c) 2017 Mateusz Loskot <mateusz at loskot dot net>
  3. # All rights reserved.
  4. #
  5. # Distributed under the Boost Software License, Version 1.0.
  6. # (See accompanying file LICENSE_1_0.txt or copy at
  7. # http://www.boost.org/LICENSE_1_0.txt)
  8. #
  9. message(STATUS "Boost.GIL: Configuring examples")
  10. if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
  11. file(GLOB_RECURSE _examples ${CMAKE_CURRENT_LIST_DIR}/*.cpp CONFIGURE_DEPEND)
  12. else()
  13. file(GLOB_RECURSE _examples ${CMAKE_CURRENT_LIST_DIR}/*.cpp)
  14. endif()
  15. foreach(_example ${_examples})
  16. get_filename_component(_name ${_example} NAME_WE)
  17. add_executable(example_${_name} ${_name}.cpp)
  18. target_compile_definitions(example_${_name} PRIVATE BOOST_GIL_USE_CONCEPT_CHECK=1)
  19. # Unfortunately, ALIAS of imported target is not supported
  20. # see https://github.com/conan-io/conan/issues/2125
  21. if(GIL_USE_CONAN)
  22. target_link_libraries(example_${_name}
  23. PRIVATE
  24. gil_compile_options
  25. gil_include_directories
  26. Boost::disable_autolinking
  27. Boost::filesystem
  28. CONAN_PKG::libjpeg
  29. CONAN_PKG::libpng
  30. CONAN_PKG::libtiff)
  31. else()
  32. target_link_libraries(example_${_name}
  33. PRIVATE
  34. gil_compile_options
  35. gil_include_directories
  36. gil_dependencies)
  37. endif()
  38. unset(_name)
  39. endforeach()
  40. unset(_example)
  41. unset(_examples)