Skip to content

building your example with cmake #5

Description

@LaDeesseBisounours

Hello,

I liked your example but wanted to build my project with CMake.
So now I share a CMakeLists.txt file to build it.
Can you allow me to push on a branch and make you a pull request ?
Else I just paste the file here

CMakeLists.txt

cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_COMPILER "/usr/bin/g++")
project(testparser VERSION 1.0 )
find_package(FLEX 2.6 REQUIRED)
find_package(BISON 3.0 REQUIRED)
include_directories("./")

set(SRC_DIR ".")
set(PARSER_DIR "${CMAKE_CURRENT_BINARY_DIR}")

set(LEXER_SOURCE_OUT "${PARSER_DIR}/scanner.cpp")
set(PARSER_SOURCE_OUT "${PARSER_DIR}/parser.cpp")

flex_target(LEXER "${SRC_DIR}/scanner.l" "${LEXER_SOURCE_OUT}" )
bison_target(PARSER "${SRC_DIR}/parser.y" "${PARSER_SOURCE_OUT}") 
add_flex_bison_dependency(LEXER PARSER)
add_executable(testparser "${SRC_DIR}/main.cpp" "${SRC_DIR}/interpreter.cpp" "${SRC_DIR}/command.cpp"  "${LEXER_SOURCE_OUT}" "${PARSER_SOURCE_OUT}")
target_include_directories(testparser PRIVATE "${PARSER_DIR}")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions