# Can't find fltk library with cmake (ERROR)

**URL:** <https://discourse.cmake.org/t/cant-find-fltk-library-with-cmake-error/867>\
**Category:** Code\
**Tags:** os:windows\
**Created:** [March 27, 2020, 6:12am UTC](https://discourse.cmake.org/t/cant-find-fltk-library-with-cmake-error/867 "2020-03-27T06:12:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mrityunjay\_Jha](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mrityunjay_jha/32/449_2.png) [@Mrityunjay\_Jha](https://discourse.cmake.org/u/Mrityunjay_Jha)\
**Post date:** [March 27, 2020, 6:12am UTC](https://discourse.cmake.org/t/cant-find-fltk-library-with-cmake-error/867/1 "2020-03-27T06:12:47Z")

</div>

I am not able to link fltk library using cmake script.Here is my CMakeLists.txt file:

```
cmake_minimum_required(VERSION 3.16.5)
SET(CMake_C_Compiler_Works 1)
SET(CMake_CXX_Compiler_Works 1)
 project(Windows)
find_package( REQUIRED NO_MODULE)
SET(src ./Hello_Windows.cpp)
add_executable(win ${src})
 target_link_libraries(win fltk)

```

But cmake is reporting that it is unable to locate fltk file and reports error  
cmake Error at CMakeLists.txt:7 (find\_package):  
Could not find a package configuration file provided by “FLTK” with any of  
the following names:

```
FLTKConfig.cmake
fltk-config.cmake

Add the installation prefix of "FLTK" to CMAKE_PREFIX_PATH or set
" FLTK_DIR" to a directory containing one of the above files. If "FLTK"
provides a separate development package or SDK, be sure it has been
installed.

  -- Configuring incomplete, errors occurred!
See also "D:/C++_project/build/CMakeFiles/CMakeOutput.log".

```

I have installed my fltk library with pacman on MSYS2

---

<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:** [March 27, 2020, 11:37am UTC](https://discourse.cmake.org/t/cant-find-fltk-library-with-cmake-error/867/2 "2020-03-27T11:37:45Z")

</div>

> [@Mrityunjay\_Jha](#):
>
> SET(CMake\_C\_Compiler\_Works 1)

Why are you manually setting these?

> [@Mrityunjay\_Jha](#):
>
> But cmake is reporting that it is unable to locate fltk file and reports error

3.17 has `--debug-find` which can help you see where CMake is looking. I suspect that FLTK is installing its configuration to the wrong place or that it doesn’t have one. If the latter, you’ll probably do better by removing the `NO_MODULE` so that the `FindFLTK.cmake` that CMake ships can be used.

---

<div class="post-metadata">

**Author:** ![Mrityunjay\_Jha](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mrityunjay_jha/32/449_2.png) [@Mrityunjay\_Jha](https://discourse.cmake.org/u/Mrityunjay_Jha)\
**Post date:** [March 27, 2020, 11:49am UTC](https://discourse.cmake.org/t/cant-find-fltk-library-with-cmake-error/867/3 "2020-03-27T11:49:46Z")

</div>

Yeah,sorry for that I was using that flag when I was trying to resolve an error.Let me try.
