File: CMakeLists.txt

package info (click to toggle)
datatype99 1.6.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 476 kB
  • sloc: ansic: 1,071; sh: 43; makefile: 6
file content (48 lines) | stat: -rw-r--r-- 1,415 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cmake_minimum_required(VERSION 3.16)
project(examples LANGUAGES C)

set(GCC_OPTIONS -Wall -Wextra -pedantic -ftrack-macro-expansion=0
                -fsanitize=address)

set(CLANG_OPTIONS -fmacro-backtrace-limit=1 -fsanitize=address)

# Enable a standard-conforming C99/C11 preprocessor.
set(MSVC_OPTIONS /std:c11)

if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
  add_compile_options(${GCC_OPTIONS})
  add_link_options(-fsanitize=address)
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
  add_compile_options(${CLANG_OPTIONS})
  add_link_options(-fsanitize=address)
elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
  add_compile_options(${MSVC_OPTIONS})
elseif(CMAKE_C_COMPILER_ID STREQUAL "TinyCC")
  add_compile_definitions(ML99_ALLOW_POOR_DIAGNOSTICS)
endif()

add_executable(array_in_variant array_in_variant.c)
add_executable(ast ast.c)
add_executable(binary_tree_malloc binary_tree_malloc.c)
add_executable(binary_tree binary_tree.c)
add_executable(token token.c)

add_subdirectory(derive)

add_subdirectory(.. build)

get_property(
  EXAMPLES
  DIRECTORY .
  PROPERTY BUILDSYSTEM_TARGETS)

get_property(
  DERIVE_EXAMPLES
  DIRECTORY derive
  PROPERTY BUILDSYSTEM_TARGETS)

foreach(TARGET ${EXAMPLES};${DERIVE_EXAMPLES})
  target_link_libraries(${TARGET} datatype99)
  set_target_properties(${TARGET} PROPERTIES C_STANDARD 99 C_STANDARD_REQUIRED
                                                           ON)
endforeach()