# Cmake doesn't pickup where the required executable is (FLEX)

**URL:** https://discourse.cmake.org/t/cmake-doesnt-pickup-where-the-required-executable-is-flex/5588
**Category:** Code
**Tags:** os:windows, comp:gcc
**Created:** [May 2, 2022, 4:58am UTC](https://discourse.cmake.org/t/cmake-doesnt-pickup-where-the-required-executable-is-flex/5588 "2022-05-02T04:58:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Rellotscrewdriver](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rellotscrewdriver/32/2400_2.png) [@Rellotscrewdriver](https://discourse.cmake.org/u/Rellotscrewdriver)
#### Post date: [May 2, 2022, 4:58am UTC](https://discourse.cmake.org/t/cmake-doesnt-pickup-where-the-required-executable-is-flex/5588/1 "2022-05-02T04:58:38Z")

</div>

Hi,

I’m trying to conifigure a third-party project using cmake 3.23  
which requires FLEX, and I have both of them on my machine  
and for some reason it doesn’t pick up where they are,  
telling me that it couldn’t find flex executable.

here’s the error message:

```auto
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find FLEX (missing: FLEX_EXECUTABLE)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.23/Modules/FindFLEX.cmake:264 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:109 (find_package)

```

so I tried going through error source  
and I couldn’t find where cmake points the directory for to pickup the executable,  
docs didn’t help much either.  
so I want to know where the hell cmake points the directory  
or how would I change it’s directory without f\*\*king this everything up.

I also face a similar issue when conifiguring for codeblocks  
where I need to manually set it’s directory everytime  
whenever I conifigure a project with codeblocks

Thank you.  
Rellot’s screwdriver

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 2, 2022, 1:54pm UTC](https://discourse.cmake.org/t/cmake-doesnt-pickup-where-the-required-executable-is-flex/5588/2 "2022-05-02T13:54:38Z")

</div>

Does the output from `--debug-find` help at all?

Without more context into where this `flex` binary actually exists, it’s hard to give support. Note that `FindFLEX` (and many other find modules) really only search “default” locations out of the box. For more custom setups (which is sadly common on Windows), CMake will need assistance. You can set `FLEX_EXECUTABLE` manually on the command line.

---

<div class="post-metadata">

### Author: ![Rellotscrewdriver](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rellotscrewdriver/32/2400_2.png) [@Rellotscrewdriver](https://discourse.cmake.org/u/Rellotscrewdriver)
#### Post date: [May 3, 2022, 11:18am UTC](https://discourse.cmake.org/t/cmake-doesnt-pickup-where-the-required-executable-is-flex/5588/3 "2022-05-03T11:18:52Z")

</div>

okay, so i tried doing --debug-find and it gave me a lot of paths that it expects to where flex executable should be.  
I chose to put it in same directory where the cmake expects to have the executables and headers and it worked fine. Same with bison as some headers are used in flex.

The only problem I got is with iconv library… but i guess I’ll handle it from there. Thank you for helping and suggesting that command.

(if anyone’s curious, I’m trying to configure latest Doxygen version on my 32-bit machine, they only x64 bulids)
