File: RunCMakeTest.cmake

package info (click to toggle)
cmake 4.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 152,344 kB
  • sloc: ansic: 403,894; cpp: 303,807; sh: 4,097; python: 3,582; yacc: 3,106; lex: 1,279; f90: 538; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 108; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (41 lines) | stat: -rw-r--r-- 1,194 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
include(RunCMake)

# Locate Diab toolchain
if(RunCMake_GENERATOR MATCHES "Makefile|Ninja")
  file(GLOB _diab_toolchains
    "${CMake_TEST_Diab_TOOLCHAINS}/*/*/bin/dcc*" )
  if(_diab_toolchains STREQUAL "")
    message(FATAL_ERROR "Could not find any Diab toolchains at: ${CMake_TEST_Diab_TOOLCHAINS}.")
  endif()
endif()

function(run_toolchain case)
  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
  run_cmake_with_options(${case} ${ARGN})
  set(RunCMake_TEST_NO_CLEAN 1)
  run_cmake_command(${case}-build ${CMAKE_COMMAND} --build .)
endfunction()


foreach(_diab_toolchain IN LISTS _diab_toolchains)
  message(STATUS "Found Diab toolchain: ${_diab_toolchain}")
  cmake_path(GET _diab_toolchain PARENT_PATH BIN_DIR)
  set(c_comp ${BIN_DIR}/dcc)
  set(cxx_comp ${BIN_DIR}/dplus)

  # Create an executable from .c sources only.
  run_toolchain(diab-c
    -DCMAKE_C_COMPILER=${c_comp}
  )

  # Create an executale from .c and .cxx sources.
  run_toolchain(diab-cxx
    -DCMAKE_C_COMPILER=${c_comp}
    -DCMAKE_CXX_COMPILER=${cxx_comp}
  )

  # Create an executable from mixed, c, cxx and assembly.
  run_toolchain(diab-asm
    -DCMAKE_ASM_COMPILER=${c_comp}
  )
endforeach()