# CMake 4.0.0 doesn't seem to look in it's own Modules directory for modules by default

**URL:** https://discourse.cmake.org/t/cmake-4-0-0-doesnt-seem-to-look-in-its-own-modules-directory-for-modules-by-default/13882
**Category:** Usage
**Created:** [April 4, 2025, 8:15am UTC](https://discourse.cmake.org/t/cmake-4-0-0-doesnt-seem-to-look-in-its-own-modules-directory-for-modules-by-default/13882 "2025-04-04T08:15:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![SirCodeAlot](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/f1d935/32.png) [@SirCodeAlot](https://discourse.cmake.org/u/SirCodeAlot)
#### Post date: [April 4, 2025, 8:15am UTC](https://discourse.cmake.org/t/cmake-4-0-0-doesnt-seem-to-look-in-its-own-modules-directory-for-modules-by-default/13882/1 "2025-04-04T08:15:00Z")

</div>

I built CMake 4.0.0 like this (on a Rocky Linux 9 host):  
bootstrap --prefix=/usr/local  
make -j$(nproc) && make -j$(nproc) install/strip

/usr/local/share/cmake-4.0/Modules/FindBoost.cmake (among 444 other modules) was installed.  
But find\_package does not seem to find it. In the output is also the result of these two lines from my CMakeLists.txt:

```auto
message(STATUS "CMake system module path: ${CMAKE_SYSTEM_MODULE_PATH}")
message(STATUS "CMake module path: ${CMAKE_MODULE_PATH}")

```

```auto
[proc] Executing command: /usr/local/bin/cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ --no-warn-unused-cli -S/repo/service-core -B/repo/service-core/build -G "Unix Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Found Git: /usr/bin/git (found version "2.43.5")
[cmake] -- The CXX compiler identification is GNU 11.5.0
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /usr/bin/g++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- CMake system module path:
[cmake] -- CMake module path: /repo/service-core/cmake
[cmake] -- Found OpenSSL: /usr/lib64/libcrypto.so (found suitable version "3.2.2", minimum required is "3.0")
[cmake] -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
[cmake] -- Found OpenSSL: /usr/lib64/libcrypto.so (found version "3.2.2")
[cmake] CMake Error at /usr/local/share/cmake-4.0/Modules/CMakeFindDependencyMacro.cmake:78 (find_package):
[cmake] By not providing "FindBoost.cmake" in CMAKE_MODULE_PATH this project has
[cmake] asked CMake to find a package configuration file provided by "Boost", but
[cmake] CMake did not find one.

```

The upstream provided CMake 3.26.5 did not have this problem. But I needed generator expressions for CXX\_CPPCHECK, thus I decided to upgrade.  
Can anybody help me find out what is wrong?

---

<div class="post-metadata">

### Author: ![SirCodeAlot](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/f1d935/32.png) [@SirCodeAlot](https://discourse.cmake.org/u/SirCodeAlot)
#### Post date: [April 4, 2025, 8:32am UTC](https://discourse.cmake.org/t/cmake-4-0-0-doesnt-seem-to-look-in-its-own-modules-directory-for-modules-by-default/13882/2 "2025-04-04T08:32:44Z")

</div>

Explicitly adding the /usr/local/share/cmake-4.0/Modules dir to CMAKE\_MODULE\_PATH took me a bit further.

```auto
[cmake] CMake Error at /usr/local/share/cmake-4.0/Modules/FindBoost.cmake:389 (message):
[cmake] The FindBoost module has been removed by policy CMP0167.
[cmake] Call Stack (most recent call first):
[cmake] /usr/local/share/cmake-4.0/Modules/CMakeFindDependencyMacro.cmake:78 (find_package)
[cmake] /usr/lib64/cmake/cpprestsdk/cpprestsdk-config.cmake:20 (find_dependency)
[cmake] CMakeLists.txt:30 (find_package)

```

I am using the Rocky Linux 9 provided boost-devel 1.75.0 rpm package. Which does not contain any cmake related files. I hade the impression boost started to provided proper cmake configuration from version 1.70 (or something similar). Maybe the rpm packager wasn’t aware of that…

So my current solution is involving this:

```auto
if (POLICY CMP0167)
  cmake_policy(SET CMP0167 OLD)
endif ()

```
