find_package path on windows

https://cmake.org/cmake/help/v3.0/command/find_package.html

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

It cant parse path on windows.

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

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

[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?

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 property at least. You can generate a wrapper .bat file to inject that directory into PATH as well for more general usage.

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

And the folder structure
image

When I build it with

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)

> [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

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