File: KDbAddExamples.cmake

package info (click to toggle)
kdb 3.2.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,276 kB
  • sloc: cpp: 38,360; yacc: 940; python: 779; sh: 711; ansic: 440; lex: 367; xml: 182; sql: 51; makefile: 10
file content (27 lines) | stat: -rw-r--r-- 872 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Additional CMake macros
#
# Copyright (C) 2015-2017 Jarosław Staniek <staniek@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

if(__kdb_add_examples)
  return()
endif()
set(__kdb_add_examples YES)

include(KDbAddSimpleOption)

# Adds BUILD_EXAMPLES option to enable examples. If enabled, build in examples/ subdirectory
# is enabled. If optional argument ARG1 is ON, building examples will be ON by default.
# Otherwise building examples will be OFF. ARG1 is OFF by default.
macro(kdb_add_examples)
  set(_SET ${ARGV0})
  if (NOT "${_SET}" STREQUAL ON)
    set(_SET OFF)
  endif()
  simple_option(BUILD_EXAMPLES "Build example applications" ${_SET})
  if (BUILD_EXAMPLES AND EXISTS ${CMAKE_SOURCE_DIR}/examples)
    add_subdirectory(examples)
  endif()
endmacro()