[英]Cmake with Flex/Bison on windows
I downdloaded this flex/bison executables. 我下载了这个 flex / bison可执行文件。 I copied them to C:\\Program Files\\Flex-Bison
. 我将它们复制到C:\\Program Files\\Flex-Bison
。 I also added this dir to Path When using this buildscript, how can I make CMake find the executables in this folder? 我还将此目录添加到Path使用此构建脚本时,如何使CMake在此文件夹中找到可执行文件?
CMAKE_MINIMUM_REQUIRED(VERSION 3.8.2)
find_package(FLEX)
if(NOT FLEX_FOUND)
message(SEND_ERROR "Flex not found")
endif()
find_package(BISON)
if(NOT BISON_FOUND)
message(SEND_ERROR "Bison not found")
endif()
I checked FindFlex and FindBISON CMake modules and they don't seem to use the usual <package>_DIR
and <package>_ROOT
hints (the latter would also have been useful for find_program
, which has a mode to utilize that). 我检查了FindFlex和FindBISON CMake模块,它们似乎没有使用通常的<package>_DIR
和<package>_ROOT
提示(后者对于find_program
也是有用的,后者具有一种使用方式)。
So, the easiest solution would be to place both executables in your PATH
variable, which will allow their invocation from anywhere. 因此,最简单的解决方案是将两个可执行文件都放在PATH
变量中,这将允许从任何位置调用它们。 Otherwise, you may also amend that PATH
with a custom location of your choice. 否则,您还可以使用您选择的自定义位置来修改该PATH
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.