]> git.bts.cx Git - sun.git/blob - tests/CMakeLists.txt
Initial commit
[sun.git] / tests / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.10)
2
3 project(suntest C)
4
5 set(SUNCC ${PROJECT_BINARY_DIR}/../compiler/suncc)
6 function(target_add_sun_sources TARGET)
7 foreach(SRC ${ARGN})
8 cmake_path(GET SRC STEM SUN_BASENAME)
9 set(SUN_OUTPUT ${PROJECT_BINARY_DIR}/${SUN_BASENAME}.c)
10
11 add_custom_command(
12 OUTPUT ${SUN_OUTPUT}
13 DEPENDS ${SRC}
14 COMMAND ${SUNCC} ${SUN_OUTPUT} ${SRC}
15 )
16
17 list(APPEND SUN_C_SOURCES ${SUN_OUTPUT})
18 endforeach()
19
20 target_sources(${TARGET} PRIVATE ${SUN_C_SOURCES})
21 endfunction()
22
23 set(SUN_TEST_SOURCES
24 ${CMAKE_CURRENT_SOURCE_DIR}/test_1.sun
25 )
26
27 add_executable(suntest main.c)
28 target_add_sun_sources(suntest ${SUN_TEST_SOURCES})
29 #target_include_directories(suncc PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
30 #target_link_libraries(suncc suncore)
31 #target_link_libraries(suncc ${FLEX_LIBRARIES})