[英]CMake not invoking FLEX/BISON
I have the following CMake file, which is part of a bigger project (and as such in its folder and imported by upper levels using add_subdirectory(...)
我有以下CMake文件,它是一个更大的项目的一部分(在其文件夹中,并使用
add_subdirectory(...)
由上层导入
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/include/Parser)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
bison_target(XPathParser
XPath.yy
${CMAKE_CURRENT_BINARY_DIR}/XPathParser.cpp
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/XPathParser.h)
flex_target(XPathScanner
XPath.flex
${CMAKE_CURRENT_BINARY_DIR}/XPathScanner.cpp
COMPILE_FLAGS "-Cm -B -L --c++ --nounistd")
add_flex_bison_dependency(XPathScanner XPathParser)
set_source_files_properties(${BISON_XPathParser_OUTPUTS}
${FLEX_XPathScanner_OUTPUTS}
PROPERTIES
COMPILE_FLAGS -Wno-sign-compare
COMPILE_FLAGS -Wno-effc++)
add_library(xpath OBJECT
${BISON_Parser_OUTPUTS}
${FLEX_Lexer_OUTPUTS}
${CMAKE_CURRENT_LIST_DIR}/XPathParserDriver.cpp)
In my knowledge, this CMake should execute FLEX and BISON, that in turn would generate the C++ files, before the actual C++ compiler invocation. 据我所知,这个CMake应该执行FLEX和BISON,然后在实际的C ++编译器调用之前生成C ++文件。
For some reason beyond my understanding, this is not true. 出于某种原因,超出我的理解,这是不正确的。 I tried to clear CMake cache and rerun it from scratch;
我试图清除CMake缓存并从头开始重新运行; still, there is no sign of FLEX nor BISON within the CMake generated files.
仍然,CMake生成的文件中没有FLEX或BISON的迹象。
Of course, CMake finds both FLEX and BISON and properly sets the bison_target
and flex_target
macros (I tested it by messing with them adding random values: CMake gets angry and throws me an error). 当然,CMake找到FLEX和BISON并正确设置
bison_target
和flex_target
宏(我通过弄乱它们添加随机值来测试它:CMake生气并且引发了我的错误)。
Any clue on what is going on and what am I missing? 关于发生了什么以及我错过了什么的任何线索?
In add_library
, you add BISON_Parser_OUTPUTS
and FLEX_Lexer_OUTPUTS
dependencies. 在
add_library
,添加BISON_Parser_OUTPUTS
和FLEX_Lexer_OUTPUTS
依赖项。 Instead, it should be BISON_XPathParser_OUTPUTS
and FLEX_XPathScanner_OUTPUTS
respectively (since you gave them such names). 相反,它应该分别是
BISON_XPathParser_OUTPUTS
和FLEX_XPathScanner_OUTPUTS
(因为你给了他们这样的名字)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.