# Policy CMP0111 is not set: An imported target missing its location property fails during generation. Run "cmake --help-policy CMP0111" for policy details

**URL:** <https://discourse.cmake.org/t/policy-cmp0111-is-not-set-an-imported-target-missing-its-location-property-fails-during-generation-run-cmake-help-policy-cmp0111-for-policy-details/11642>\
**Category:** Code\
**Tags:** os:windows\
**Created:** [September 11, 2024, 3:20am UTC](https://discourse.cmake.org/t/policy-cmp0111-is-not-set-an-imported-target-missing-its-location-property-fails-during-generation-run-cmake-help-policy-cmp0111-for-policy-details/11642 "2024-09-11T03:20:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sea\_Sea](https://discourse.cmake.org/user_avatar/discourse.cmake.org/sea_sea/32/4025_2.png) [@Sea\_Sea](https://discourse.cmake.org/u/Sea_Sea)\
**Post date:** [September 11, 2024, 3:20am UTC](https://discourse.cmake.org/t/policy-cmp0111-is-not-set-an-imported-target-missing-its-location-property-fails-during-generation-run-cmake-help-policy-cmp0111-for-policy-details/11642/1 "2024-09-11T03:20:47Z")

</div>

[https://docs.opencv.org/4.x/db/df5/tutorial\_linux\_gcc\_cmake.html](https://docs.opencv.org/4.x/db/df5/tutorial_linux_gcc_cmake.html)

I just install the opencv with debug  
and follow the toturial to run opencv.

windows  
cmake -G “Visual Studio 17 2022” `

It show the error.  
If I build opencv with Release, it will not show the below.

```auto
CMake Warning (dev) in 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.

  IMPORTED_IMPLIB not set for imported target "opencv_xphoto" configuration
  "RelWithDebInfo".
This warning is for project developers. Use -Wno-dev to suppress it.

-- Generating done (0.1s)

CMake Generate step failed. Build files cannot be regenerated correctly.

```

---

<div class="post-metadata">

**Author:** ![retif](https://discourse.cmake.org/user_avatar/discourse.cmake.org/retif/32/1776_2.png) [@retif](https://discourse.cmake.org/u/retif)\
**Post date:** [September 11, 2024, 8:15am UTC](https://discourse.cmake.org/t/policy-cmp0111-is-not-set-an-imported-target-missing-its-location-property-fails-during-generation-run-cmake-help-policy-cmp0111-for-policy-details/11642/2 "2024-09-11T08:15:40Z")

</div>

It looks like you will need to configure the project with `RelWithDebInfo` build type instead of the one that fails, or perhaps add a mapping with [CMAKE\_MAP\_IMPORTED\_CONFIG\_\*](https://cmake.org/cmake/help/latest/variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG.html).
