cmake_minimum_required(VERSION 3.8) project(tprcc LANGUAGES CXX) set (CMAKE_CXX_STANDARD 17) add_compile_options(-Wall -Wextra) aux_source_directory("src" SRC_DIR) aux_source_directory("src/tpr" SRC_TPR_DIR) set(TPR_PARSER_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated-tpr") set (SRC_GENERATED "${TPR_PARSER_DIR}/tpr-parser.cpp" "${TPR_PARSER_DIR}/tpr-scanner.cpp") set (SOURCES ${SRC_DIR} ${SRC_TPR_DIR} ${SRC_GENERATED} ) add_custom_command( DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.l OUTPUT ${TPR_PARSER_DIR}/tpr-scanner.cpp COMMAND mkdir -p "${TPR_PARSER_DIR}" && flex -+ -o "${TPR_PARSER_DIR}/tpr-scanner.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.l" ) add_custom_command( DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.ypp OUTPUT ${TPR_PARSER_DIR}/tpr-parser.cpp COMMAND mkdir -p "${TPR_PARSER_DIR}/include/tpr-parser" && ${CMAKE_CURRENT_SOURCE_DIR}/bison-wrapper.sh "${TPR_PARSER_DIR}/tpr-parser.cpp" "${TPR_PARSER_DIR}/include/tpr-parser/tpr-parser.hpp" "${TPR_PARSER_DIR}/include/tpr-parser/location.hh" --header=tpr-parser.hpp ${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.ypp ) SET_SOURCE_FILES_PROPERTIES(${SRC_GENERATED} PROPERTIES GENERATED 1) add_executable(${PROJECT_NAME} ${SOURCES}) target_include_directories(${PROJECT_NAME} PRIVATE "${TPR_PARSER_DIR}/include" "${TPR_PARSER_DIR}/include/tpr-parser") target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include") # TEMPORARY FIx: #target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")