cmake_minimum_required(VERSION 3.10) find_package(BISON) find_package(FLEX) project(sun C) BISON_TARGET(SunParser ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/compiler/sun.y ${CMAKE_CURRENT_BINARY_DIR}/sun_parser.c COMPILE_FLAGS -v) FLEX_TARGET(SunScanner ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/compiler/sun.l ${CMAKE_CURRENT_BINARY_DIR}/sun_lexer.c COMPILE_FLAGS --header-file=${CMAKE_CURRENT_BINARY_DIR}/sun_lexer.h) ADD_FLEX_BISON_DEPENDENCY(SunScanner SunParser) set(SUN_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/compiler/compiler.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/compiler/compiler_internal.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/compiler/compiler.c ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/compiler/vm_generator.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/compiler/vm_generator.c ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/tree/crc32.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/tree/data_type.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/tree/data_type.c ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/tree/node.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/tree/node.c ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/tree/node_type.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/tree/node_type.c ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/tree/operator_type.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/tree/operator_type.c ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/tree/tree.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/tree/tree.c ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/vm/fixed.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/vm/fixed.c ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/vm/instruction.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/vm/instruction.c ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/vm/vm.h ${CMAKE_CURRENT_SOURCE_DIR}/src/sun/vm/vm.c ${BISON_SunParser_OUTPUTS} ${FLEX_SunScanner_OUTPUTS} ) add_library(sun ${SUN_SOURCES}) #add_executable(suncc ${SUNCC_SOURCES}) target_include_directories(sun PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) # So the Flex/Bison code can find header target_include_directories(sun PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) # So our code can find Flex/Bison code #target_link_libraries(sun suncore) #target_link_libraries(suncc ${FLEX_LIBRARIES})