CMakeLists.txt.in 925 Bytes
Newer Older
Fred Baksik's avatar
Fred Baksik committed
1 2 3 4 5 6 7
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

project(test C)

Fred Baksik's avatar
Fred Baksik committed
8 9 10 11
if(CMAKE_C_COMPILER_ID STREQUAL "GHS")
  add_link_options("-non_shared")
endif()

Fred Baksik's avatar
Fred Baksik committed
12
if(RUN_TEST STREQUAL "RELEASE_FLAGS")
Fred Baksik's avatar
Fred Baksik committed
13 14 15
  #RELEASE flags used when CMAKE_BUILD_TYPE is undefined
  string(APPEND CMAKE_C_FLAGS_RELEASE " -unexpected_release_option")
  add_executable(test_none test.c)
Fred Baksik's avatar
Fred Baksik committed
16 17 18
endif()

if(RUN_TEST STREQUAL "KERNEL_FLAGS")
Fred Baksik's avatar
Fred Baksik committed
19 20
  #DEBUG flag missing when -kernel is added as a compile option
  string(APPEND CMAKE_C_FLAGS_DEBUG " -required-debug-option")
Fred Baksik's avatar
Fred Baksik committed
21

Fred Baksik's avatar
Fred Baksik committed
22
  add_executable(K1 test.c)
Fred Baksik's avatar
Fred Baksik committed
23

Fred Baksik's avatar
Fred Baksik committed
24 25
  add_executable(K2 test.c)
  target_compile_options(K2 PRIVATE -kernel)
Fred Baksik's avatar
Fred Baksik committed
26

Fred Baksik's avatar
Fred Baksik committed
27 28
  add_executable(K3 test.c)
  target_compile_options(K3 PRIVATE -kernel=fast)
Fred Baksik's avatar
Fred Baksik committed
29

Fred Baksik's avatar
Fred Baksik committed
30 31
  add_executable(K4 test.c)
  target_link_options(K4 PRIVATE -kernel)
Fred Baksik's avatar
Fred Baksik committed
32
endif()