• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#
9message(STATUS "Boost.GIL: Configuring examples")
10
11if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
12  file(GLOB_RECURSE _examples ${CMAKE_CURRENT_LIST_DIR}/*.cpp CONFIGURE_DEPEND)
13else()
14  file(GLOB_RECURSE _examples ${CMAKE_CURRENT_LIST_DIR}/*.cpp)
15endif()
16
17foreach(_example ${_examples})
18  get_filename_component(_name ${_example} NAME_WE)
19  add_executable(example_${_name} ${_name}.cpp)
20  target_compile_definitions(example_${_name} PRIVATE BOOST_GIL_USE_CONCEPT_CHECK=1)
21  # Unfortunately, ALIAS of imported target is not supported
22  # see https://github.com/conan-io/conan/issues/2125
23  if(BOOST_GIL_USE_CONAN)
24    target_link_libraries(example_${_name}
25      PRIVATE
26        gil_compile_options
27        gil_include_directories
28        Boost::disable_autolinking
29        Boost::filesystem
30        CONAN_PKG::libjpeg
31        CONAN_PKG::libpng
32        CONAN_PKG::libtiff)
33  else()
34    target_link_libraries(example_${_name}
35      PRIVATE
36        gil_compile_options
37        gil_include_directories
38        gil_dependencies)
39  endif()
40
41  unset(_name)
42endforeach()
43
44unset(_example)
45unset(_examples)
46