# How find older version of library?

**URL:** https://discourse.cmake.org/t/how-find-older-version-of-library/5170
**Category:** Usage
**Created:** [March 5, 2022, 10:35am UTC](https://discourse.cmake.org/t/how-find-older-version-of-library/5170 "2022-03-05T10:35:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![AndrzejB](https://discourse.cmake.org/user_avatar/discourse.cmake.org/andrzejb/32/815_2.png) [@AndrzejB](https://discourse.cmake.org/u/AndrzejB)
#### Post date: [March 5, 2022, 10:35am UTC](https://discourse.cmake.org/t/how-find-older-version-of-library/5170/1 "2022-03-05T10:35:03Z")

</div>

I have Mint 20.3 and install wxWidgets 3.0.4 by sudo apt install libwxgtk3.0-gtk3-dev  
Now I install wxWidgeta 3.1.x from sources.  
I have CMakeLists.txt :

```auto
cmake_minimum_required(VERSION 3.7)
project(minimal_std)

set(CMAKE_CXX_STANDARD 11)

find_package(wxWidgets 3.1 COMPONENTS core base net REQUIRED)
include(${wxWidgets_USE_FILE})

add_definitions("-Werror=return-type -H")

set(SOURCE_FILES main.cpp main.h)
add_executable(minimal_std ${SOURCE_FILES})

target_link_libraries(minimal_std ${wxWidgets_LIBRARIES})

```

First I call cmake with -DCMAKE\_MODULE\_PATH=/usr/local/include/wx-3.1  
now I want test with older version, I changed  
-DCMAKE\_MODULE\_PATH=/usr/include/wx-3.0  
and find\_package(wxWidgets 3.0.4 EXACT COMPONENTS core base net REQUIRED)  
but have error

```auto
CMake Error at /home/andrzej/clion-2021.3.3/bin/cmake/linux/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find wxWidgets: Found unsuitable version "3.1.6", but required is
  exact version "3.0.4" (found
  -L/usr/local/lib;-pthread;;;-lwx_gtk2u_core-3.1;-lwx_baseu-3.1;-lwx_baseu_net-3.1)

```

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [March 5, 2022, 12:53pm UTC](https://discourse.cmake.org/t/how-find-older-version-of-library/5170/2 "2022-03-05T12:53:51Z")

</div>

Did you remove `CMakeCache.txt` file before the second CMake generation? This file stores results of `find_*` commands to avoid multiple searches.  
So, when you change your environment, it is required to remove this file to avoid unexpected results.

---

<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 5, 2022, 11:30pm UTC](https://discourse.cmake.org/t/how-find-older-version-of-library/5170/3 "2022-03-05T23:30:14Z")

</div>

Additionally, `include/wx-3.x` seems like the wrong thing for `CMAKE_MODULE_PATH` (unless the `FindwxWidgets.cmake` file is there…which seems odd). For things like this, you can pass the `--debug-find` flag to get some insight into where CMake is actually looking.
