To compile my application I need to use the Flex and Bison applications. To 
compile under Linux, all I need to do in my CMakeLists.txt file to find them is

    find_package(FLEX REQUIRED)
    find_package(BISON REQUIRED)

...and everything works as expected.

In Windows, however, I'm using the Cygwin versions of Flex and Bison which are 
installed in C:\cygwin64\bin. This doesn't seem to be on the path that 
find_package searches in Module Mode, so the search returns unsuccessfully.

However, if I try to tell find_package where to look, viz.

    find_package(FLEX REQUIRED PATHS C:/cygwin64/bin NO_DEFAULT_PATH)
    find_package(BISON REQUIRED PATHS C:/cygwin64/bin NO_DEFAULT_PATH)

...then by adding the PATHS keyword I've invoked Config mode and I get an error 
message saying:

    Could not find a package configuration file provided by "FLEX" with any of 
    the following names

        FLEXConfig.cmake
        flex-config.cmake

...because sure enough Cygwin does not provide these files.

So what can I do? Ideally I'd like to use Module Mode but provide a path hint; 
but there seems no way to do that.

At the moment I can only think of:
(a) Hard-coding add_custom_target commands to invoke flex and bison entirely 
manually when they're needed, or
(b) Writing my own FLEXConfig.cmake and BISONConfig.cmake files for use in 
Config Mode.

Both of these seem disproportionately difficult for what seems to me like it 
ought to be a common and simple problem. So is there a better solution that I'm 
missing?

-- 

Powered by kitware.com/cmake

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit https://cmake.org/services

Visit other Kitware open-source projects at https://www.kitware.com/platforms

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

This mailing list is deprecated in favor of https://discourse.cmake.org

Reply via email to