Policy CMP0111 warns about missing location for config that was removed
I am using CMake version 3.20.1 on MacOS BigSur. I wrote a custom find module for imported targets for various binaries on Windows, Linux, and MacOS. Only on MacOS do I get many copies of the following message:
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_LOCATION not set for imported target "BitDefender::Scan" configuration "MinSizeRel"
Despite disabling this build configuration with the following:
# if using a multi-config generator (Xcode or Visual Studio), limit the build types to
# the ones that we care about
if (GENERATOR_IS_MULTI_CONFIG)
set(CMAKE_CONFIGURATION_TYPES "Debug" "Release")
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}"
CACHE STRING "Semicolon separated list of supported configuration types [Debug|Release]"
FORCE
)
endif ()
# Set a default build type if none is specified for a single-config generator
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting the build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
endif ()
Am I doing something wrong to disable these configurations for single and multi config generators? On Windows I use Visual Studio, MacOS -> Xcode, Linux -> gcc.