Error "INTERFACE_LIBRARY targets may only have whitelisted properties" during "codemodel" server command
Testing our projects with cmake-3.13.0-rc1-win64-x64.zip, we are now seeing errors that are not present in 3.12
CMake Error at CMakeLists.txt:8 (add_library): INTERFACE_LIBRARY targets may only have whitelisted properties. The property "INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO" is not allowed.
CMake Error at CMakeLists.txt:8 (add_library): INTERFACE_LIBRARY targets may only have whitelisted properties. The property "INTERPROCEDURAL_OPTIMIZATION" is not allowed.
CMake Error at CMakeLists.txt:8 (add_library): INTERFACE_LIBRARY targets may only have whitelisted properties. The property "COMPILE_FLAGS" is not allowed.
CMake Error at CMakeLists.txt:8 (add_library): INTERFACE_LIBRARY targets may only have whitelisted properties. The property "CXX_EXTENSIONS" is not allowed.
CMake Error at CMakeLists.txt:8 (add_library): INTERFACE_LIBRARY targets may only have whitelisted properties. The property "CXX_STANDARD" is not allowed.
CMake Error at CMakeLists.txt:8 (add_library): INTERFACE_LIBRARY targets may only have whitelisted properties. The property "COMPILE_DEFINITIONS_RELWITHDEBINFO" is not allowed.
These do not appear when running CMake on the command-line, because they are not occurring during configure or generate, but after generation when Qt Creator requests the codemodel. I think this seems to be fallout of !2282 (merged), since prior to that codemodel didn't process INTERFACE libraries at all (DumpTarget
would just exit early). Now it goes on, So these errors are presumably coming from all the various calls to GetTargetProperty
that are present for other target types, but not allowed for INTERFACE libraries.
This can be reproduced with the attached sample interface_library_errors.7z, using the below (substitute your paths for sourceDirectory/buildDirectory, of course)
cmake -E server --debug --experimental
[== "CMake Server" ==[ {"cookie":"zimtstern","type":"handshake","protocolVersion":{"major":1}, "sourceDirectory":"...", "buildDirectory":"...", "generator":"Ninja"} ]== "CMake Server" ==]
[== "CMake Server" ==[ {"type":"configure", "cacheArguments":[]} ]== "CMake Server" ==]
[== "CMake Server" ==[ {"type":"compute"} ]== "CMake Server" ==]
[== "CMake Server" ==[ {"type":"codemodel"} ]== "CMake Server" ==]