c++ - 如何使用 Clion 和 flex 和 bison 构建 C++ CMake 项目
问题描述
我正在尝试构建一个我克隆的 git 项目,它使用 CMake 进行编译,需要 bison 和 flex。我正在使用 Windows 10 和 Clion IDE。
我已经从https://sourceforge.net/projects/winflexbison/下载了 Win flex-bison, 但我不明白如何将 CMake 指向我下载的 win_flex_bison 文件。
目前构建失败在线:
find_program(BISON_EXECUTABLE bison)
if(NOT EXISTS ${BISON_EXECUTABLE})
message("Could not find bison executable.")
endif(NOT EXISTS ${BISON_EXECUTABLE})
find_program(FLEX_EXECUTABLE flex)
if(NOT EXISTS ${FLEX_EXECUTABLE})
message("Could not find flex executable.")
endif(NOT EXISTS ${FLEX_EXECUTABLE})
IF (DEFINED FLEXLEXER_H_DIR)
include_directories(${FLEXLEXER_H_DIR})
message("Looking in ${CMAKE_REQUIRED_INCLUDES} for FlexLexer.h")
ELSE()
CHECK_INCLUDE_FILE_CXX("FlexLexer.h" HAVE_FLEXLEXER_H)
IF(NOT HAVE_FLEXLEXER_H)
UNSET(HAVE_FLEXLER_H CACHE)
message( FATAL_ERROR "Cannot find FlexLexer.h. Set FLEXLEXER_H_DIR to point to where it is to be found.." )
ENDIF()
我得到的按摩是:
Could not find bison executable.
Could not find flex executable.
-- Looking for C++ include FlexLexer.h
-- Looking for C++ include FlexLexer.h - not found
CMake Error at VALfiles/parsing/CMakeLists.txt:28 (message):
Cannot find FlexLexer.h. Set FLEXLEXER_H_DIR to point to where it is to be
found..
-- Configuring incomplete, errors occurred!
解决方案
推荐阅读
- c - c中给定范围的素数仅使用循环
- oauth - Identity Server 4 with appAuth - 如何在 IDS4 中为 appAuthResponse 设置附加参数
- aws-lambda - 从 lambda 访问用户信息
- reactjs - GatsbyJS Build – 未定义窗口/未定义模块
- python - pandas DataFrame isin 和下一行
- python - 如何让 PyCharm 显示 Django SQLite 数据库中的表?
- android - gradle 属性“实验性且不受支持”是什么意思?
- django - Django LDAP 组搜索问题
- c# - 在代码中(而不是在测试中)使用 NSubstitute(或其他允许模拟的测试框架)是一种好习惯吗?
- python-3.x - 特定段落的 Python Docx 行距