reflow-oven-control-sw/temp-profile-checker/CMakeLists.txt

41 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.8)
project(tprcc LANGUAGES CXX)
set (CMAKE_CXX_STANDARD 17)
aux_source_directory("src" SRC_DIR)
set (SRC_GENERATED "${CMAKE_CURRENT_BINARY_DIR}/tpr-parser.cpp" "${CMAKE_CURRENT_BINARY_DIR}/tpr-scanner.cpp")
set (SOURCES
${SRC_DIR}
${SRC_GENERATED}
)
add_custom_command(
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.l
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/tpr-scanner.cpp
COMMAND
flex -+ -o "${CMAKE_CURRENT_BINARY_DIR}/tpr-scanner.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.l"
)
add_custom_command(
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.ypp
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/tpr-parser.cpp
COMMAND
mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/generated" && bison -o"${CMAKE_CURRENT_BINARY_DIR}/tpr-parser.cpp" --header="${CMAKE_CURRENT_BINARY_DIR}/generated/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 "${CMAKE_CURRENT_BINARY_DIR}/generated")
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
# TEMPORARY FIx:
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")