# find\_package path on windows

**URL:** https://discourse.cmake.org/t/find-package-path-on-windows/5339
**Category:** Usage
**Tags:** os:windows
**Created:** [March 31, 2022, 3:41am UTC](https://discourse.cmake.org/t/find-package-path-on-windows/5339 "2022-03-31T03:41:10Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)
#### Post date: [March 31, 2022, 3:41am UTC](https://discourse.cmake.org/t/find-package-path-on-windows/5339/1 "2022-03-31T03:41:10Z")

</div>

[https://cmake.org/cmake/help/v3.0/command/find\_package.html](https://cmake.org/cmake/help/v3.0/command/find_package.html)

```auto
find_package(Boost REQUIRED COMPONENTS system filesystem date_time PATHS "D:\TEST\boost\debug\lib" NO_DEFAULT_PATH)

```

It cant parse path on windows.

---

<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 31, 2022, 9:18am UTC](https://discourse.cmake.org/t/find-package-path-on-windows/5339/2 "2022-03-31T09:18:46Z")

</div>

CMake use, for paths, slash as directory separator. So:

```cmake
find_package(Boost REQUIRED COMPONENTS system filesystem date_time PATHS "D:/TEST/boost/debug/lib" NO_DEFAULT_PATH)

```

---

<div class="post-metadata">

### Author: ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)
#### Post date: [March 31, 2022, 11:15am UTC](https://discourse.cmake.org/t/find-package-path-on-windows/5339/3 "2022-03-31T11:15:02Z")

</div>

> [CMake] – You might need to add D:\TEST\opencv\release\x64\vc16\bin to your PATH to be able to run your applications.

It show the message, how should I do next step?

---

<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 31, 2022, 2:02pm UTC](https://discourse.cmake.org/t/find-package-path-on-windows/5339/4 "2022-03-31T14:02:15Z")

</div>

You’ll need to add the given directory to the `PATH` environment variable. There’s not much CMake can do to help here in general. For tests, I can recommend the [`ENVIRONMENT_MODIFICATION`](https://cmake.org/cmake/help/latest/prop_test/ENVIRONMENT_MODIFICATION.html) property at least. You can generate a wrapper `.bat` file to inject that directory into `PATH` as well for more general usage.

---

<div class="post-metadata">

### Author: ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)
#### Post date: [April 1, 2022, 5:21am UTC](https://discourse.cmake.org/t/find-package-path-on-windows/5339/5 "2022-04-01T05:21:15Z")

</div>

I use the command to set env var  
`setx Protobuf_ROOT D:/TEST/protobuf/debug`

And the folder structure  
 ![image](https://discourse.cmake.org/uploads/default/original/2X/e/e16657c863c42aedda0dc2abd43a4fd705f0663c.png)

When I build it with

```auto
find_package(Protobuf)
message(" ${Protobuf_INCLUDE_DIRS}")
message(" ${Protobuf_LIBRARIES}")

```

It seem to find the release folder, but I assign the path to debug (`setx Protobuf_ROOT D:/TEST/protobuf/debug`)

```auto
> [CMake] Protobuf_INCLUDE_DIRS: D:/TEST/protobuf/debug/include
1> [CMake] Protobuf_LIBRARIES: optimized;D:/TEST/protobuf/release/lib/libprotobuf.lib;debug;D:/TEST/protobuf/debug/lib/libprotobufd.lib
1> [CMake] Protobuf_LITE_LIBRARIES: optimized;D:/TEST/protobuf/release/lib/libprotobuf-lite.lib;debug;D:/TEST/protobuf/debug/lib/libprotobuf-lited.lib

```

---

<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: [April 9, 2022, 12:33pm UTC](https://discourse.cmake.org/t/find-package-path-on-windows/5339/6 "2022-04-09T12:33:06Z")

</div>

It looks like it finds release and debug in that output to me.
