target_link_libraries: 3.23.0-rc2 missing LINK_ONLY in INTERFACE_LINK_LIBRARIES
EDIT: After tracking down the original report, the problem is that target_link_libraries
does not add $<LINK_ONLY:...>
wrappers in a static library's INTERFACE_LINK_LIBRARIES
when more than one library is specified at a time.
The original description follows.
Hi,
We use cmake to build our open source project but got an new issue with cmake new version. I built different versions with different commits and located the problematic commit "058b8a0b" between 3.23.rc1 and 3.23.rc2. I want to confirm whether the issue is cmake change or our wrong usage.
The issue is that the C language target uses lib_A's source and header files, and lib_A links another lib_B with same name head files but the detail of definitions of functions or data are little bit different. With the older CMAKE version, the target's include paths only have lib_A's, but with the new change both A and B are included, so as we have different definitions of same name function, compiler will report an error.
I found this commit's topic is "install(): Properly ignore FILE_SETs that don't exist". In CAMKE source cxx file, the change seems changed the search logic of "namelinkOnly" filesets. What I want to know are:
-
Why two different header files with same name are both added, and why the one doesn't replace the other one. Both of them are loaded so compiler reported the re-definition error. If it was our mistake, why the past CMAKE version didn't have.
-
The usage of FileSetNoExistInstall.cmake, will it run when we run cmake like "cmake .."? And I want to know its function. May it cause this issue
Thanks for your read and hope my report will help you.
Best Regards Jianliang Shen (Jianliang.Shen@arm.com)