window env variable and cmake path

I set the windows env variable
path=D:\test\fmt\debug

Then I let the cmakelist

	find_library(_FMT_LIB 
		NAMES fmt
		PATHS "D:\test\fmt\release"

The final result will be the D:\test\fmt\debug
How to let it to D:\test\fmt\release

I suspect your problem is due to the use of backslashes in the string you give to the PATHS argument. The \t will be seen as a tab character and \r as a carriage return. Paths should normally be written with forward slashes in CMake code, even for Windows. Alternatively, if you want a backslash, you need to escape it, so your string would have to be either "D:/test/fmt/release" or "D:\\test\\fmt\\release".

I use three times PATHS
Can I only declare a variable to replace them?
I dont know what is the function?

	find_library(_opencv_LIB
		NAMES opencv.lib
		PATHS "${LIB_ROOT}/opencv/include"
	)
	find_library(_opencv_LIB
		NAMES opencv_wrapper.lib
		PATHS "${LIB_ROOT}/opencv/include"
	)
	find_path(_opencv_INCLUDE_DIRS
		NAMES include/opencv_app.h
		PATHS "${LIB_ROOT}/opencv"
	)

Arguments following NAMES cannot include a directory, they must be file names only.

I can’t follow what you’re asking. Can you please provide more detail so that your question(s) are clearer?

like this
pseudocode

set(OPENCVpath "${LIB_ROOT}/opencv")
	find_library(_opencv_LIB
		NAMES opencv.lib
	)
	find_library(_opencv_LIB
		NAMES opencv_wrapper.lib
	)
	find_path(_opencv_INCLUDE_DIRS
		NAMES opencv_app.h
	)