<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>You can prepend C:\cygwin64\bin to the CMAKE_PROGRAM_PATH
      variable so that it looks there first.  While the find_package
      documentation does not mention CMAKE_PROGRAM_PATH, I know this
      works for bison and flex because that is what we do in our project
      (presumably, find_program is used internally within the
      find_package, explaining why CMAKE_PROGRAM_PATH is considered).<br>
    </p>
    <p> You could also try setting the FLEX_ROOT and BISON_ROOT
      variables to C:\cygwin64\bin or perhaps C:\cygwin64. According to
      the find_package documentation, this should allow you to set the
      search location on a per-package basis. However, I have not had
      this work for me, so your mileage may vary.<br>
    </p>
    <div class="moz-cite-prefix">Am 05.03.20 um 12:12 schrieb Stephen
      Morris:<br>
    </div>
    <blockquote type="cite"
cite="mid:DB6PR06MB3941CFD21255834F9785BDFAC9E20@DB6PR06MB3941.eurprd06.prod.outlook.com">
      <pre class="moz-quote-pre" wrap="">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?

</pre>
    </blockquote>
    <div class="moz-signature">
      <div style="width:480px; text-align: left; font-family: Arial,
        Helvetica, sans-serif;">
        <p style="color: #062d64; font-size: 14px; text-align: left;
          font-family: Arial, Helvetica, sans-serif;">
          <b>Dr. Eric Dönges</b>
          <br>
          Senior Software Engineer
        </p>
        <p style="color: #062d64; font-size: 12px; text-align: left;
          font-family: Arial, Helvetica, sans-serif;">MVTec Software
          GmbH | Arnulfstr. 205 | 80634 Munich | Germany
          <br>
          <a style="font-size: 12px; font-family: Arial, Helvetica,
            sans-serif; color: #062d64;" href="mailto:doenges@mvtec.com">doenges@mvtec.com</a>
          | Tel: +49 89 457 695-0 | <a style="font-size: 12px;
            font-family: Arial, Helvetica, sans-serif; color: #062d64;"
            href="http://www.mvtec.com">www.mvtec.com</a>
          <br>
        </p>
        <p>
          <span style="font-size: 12px; font-family: Arial, Helvetica,
            sans-serif; color: #062d64;">Find our privacy policy <a
              style="font-size: 12px; font-family: Arial, Helvetica,
              sans-serif; color: #062d64;"
              href="https://www.mvtec.com/imprint">here</a>.</span> </p>
        <p style="color: #062d64; font-size: 12px; text-align: left;
          font-family: Arial, Helvetica, sans-serif;"><img
src="https://mvtec.com/fileadmin/Redaktion/newsletter/mail-signature/newsletter-icon.png"
            valign="bottom" width="16" height="16"> <a style="font-size:
            12px; font-family: Arial, Helvetica, sans-serif; color:
            #062d64; font-weight: bold;"
            href="https://www.mvtec.com/newsletter">Sign up</a> for our
          MVTec Newsletter!</p>
        <p style="margin: 0px; color: #666; font-size: 12px; text-align:
          left; font-family: Arial, Helvetica, sans-serif;">Geschäftsführer:
          Dr. Olaf Munkelt<br>
          Amtsgericht München HRB 114695</p>
        <p style="margin: 0px; color: #666; font-size: 12px; text-align:
          left; font-family: Arial, Helvetica, sans-serif;"> </p>
        <img
src="https://www.mvtec.com/fileadmin/Redaktion/newsletter/mail-signature/mvtec-logo-line.png"
          alt="MVTec Software GmbH Logo"></div>
    </div>
  </body>
</html>