Policy CMP0026 is not set: Disallow use of the LOCATION target property. Run "cmake --help-policy CMP0026" for policy details.
时间: 2024-02-29 22:51:07 浏览: 28
这是一个CMake的警告信息,意思是不允许使用LOCATION目标属性。在CMake中,LOCATION属性是用来指定构建目标的输出路径。这个警告是由于该属性被认为是过时的,因为它不支持多配置生成器。如果需要使用多配置生成器,建议使用GENERATOR_EXPRESSIONS属性代替LOCATION属性。
为了解决这个警告,可以在CMakeLists.txt文件中添加以下代码:
```
if(POLICY CMP0026)
cmake_policy(SET CMP0026 NEW)
endif()
```
这会将CMP0026策略设置为NEW,表示允许使用LOCATION属性。当然,也可以使用GENERATOR_EXPRESSIONS属性代替LOCATION属性,避免这个警告。
相关问题
CMake Warning (dev) in data-plane/suricata-3.0/src/CMakeLists.txt: Policy CMP0111 is not set: An imported target missing its location property fails during generation. Run "cmake --help-policy CMP0111" for policy details. Use the cmake_policy command to set the policy and suppress this warning.
这是 CMake 的一个开发者警告,意思是当前 CMakeLists.txt 文件中使用了一个未设置位置属性的导入目标,可能会在生成期间失败。建议开发者使用 cmake_policy 命令来设置 CMP0111 策略并禁用该警告,或者在 CMakeLists.txt 文件中设置该导入目标的位置属性,以免出现编译问题。如果你不是开发者,可以使用 -Wno-dev 参数来忽略该警告。
CMake Warning (dev) at CMakeLists.txt:5 (set): Syntax error in cmake code at E:/PycharmProjects/mend/tensorrtx/yolov5/CMakeLists.txt:5 when parsing string E:\itOpencv\opencv\build Invalid escape sequence \i Policy CMP0010 is not set: Bad variable reference syntax is an error. Run "cmake --help-policy CMP0010" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at CMakeLists.txt:10 (set): Syntax error in cmake code at
这个警告信息表明,在 CMakeLists.txt 文件的第 5 行和第 10 行出现了语法错误。具体地说,第 5 行中的字符串 "E:\itOpencv\opencv\build" 中的反斜杠 "\" 被视为无效的转义序列,需要进行修复。在 CMake 中,反斜杠是用来进行路径分隔符转义的,因此您可以将路径中的反斜杠改为正斜杠 "/",或者将每个反斜杠都加倍,即将 "\" 改为 "\\"。另外,警告信息中提到了 CMP0010 策略,您可以通过在 CMakeLists.txt 文件中添加 `cmake_policy(SET CMP0010 NEW)` 来设置该策略并消除警告。
相关推荐
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)