![]() |
|
CMake question about find_package (WIndows) |
ZoriaRPG
Member #16,714
July 2017
![]() |
Right now, in our CMakeLists, we have a simple call to find flex and bison: find_package(BISON QUIET) find_package(FLEX QUIET) The issue here, is, that if CMake is building for MSVC, I want it to use a specific (provided) version of flex-bison. I tried a variety of permutations to find_package, but I keep coming up empty. The files are: ./winflex/win-flex.exe Do I need to make modules to load these? Hoe exactly can I sub out those calls to load these specific files if(MSVC) ? 1#############################################################
2# Build the ZScript parser
3#############################################################
4
5find_package(BISON QUIET)
6find_package(FLEX QUIET)
7
8if(${BISON_FOUND} AND ${FLEX_FOUND} AND WANT_ZSCRIPT)
9 if(MSVC)
10 set(FLEXFLAGS "--wincompat")
11 endif()
12 FLEX_TARGET(ZScriptLexer ${CMAKE_SOURCE_DIR}/src/parser/ffscript.lpp ${CMAKE_SOURCE_DIR}/src/parser/lex.yy.cpp COMPILE_FLAGS ${FLEXFLAGS})
13 BISON_TARGET(ZScriptParser ${CMAKE_SOURCE_DIR}/src/parser/ffscript.ypp ${CMAKE_SOURCE_DIR}/src/parser/y.tab.cpp)
14 add_flex_bison_dependency(ZScriptLexer ZScriptParser)
15else()
16 message(WARNING "Flex and Bison not found. ZQuest will be compiled without the ZScript parser.")
17 set(ZQUEST_ZSCRIPT_SOURCES ${ZQUEST_ZSCRIPT_SOURCES_NOPARSER})
18endif()
The CMake docs absolutely suck, with no true examples and whatnot. if I need a module, would someone please carefully explain WTF I need to do to ad it? Source CMakeLists file is here: CMake Modules, here: the reason that I am doing this, is that if a user has both MSVC and MinGW32 installed, then CMake finds the *nix flex and the *nix Bison first, and of course, if using MSVC to compile, those do not work. I know only a bit about CMake and I could use some help on this one. Many thanks. .
|
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Don't use the cmake docs, they do suck. Use the manual instead. Basically what you have to do is set a build time variable that controls the call to flex and bison. Here's a CHM version of the cmake manual. You'll wonder why you never used it before.... https://bitbucket.org/bugsquasher/unofficial-allegro-5-binaries/downloads/CMake314rc4.chm https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|