bug: do not redefine targets in config file.
If the config file is included twice (via `find_dependency()` or `find_package()`) some of the targets could get redefined, breaking the configuration.
This commit is contained in:
		
							parent
							
								
									51d2b0895c
								
							
						
					
					
						commit
						1f68a41e38
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		|  | @ -38,7 +38,10 @@ foreach (_target | ||||||
|          type_expr) |          type_expr) | ||||||
|     set(scoped_name "googleapis-c++::${_target}_protos") |     set(scoped_name "googleapis-c++::${_target}_protos") | ||||||
|     set(imported_name "googleapis_cpp_${_target}_protos") |     set(imported_name "googleapis_cpp_${_target}_protos") | ||||||
|  |     if (NOT TARGET ${scoped_name}) | ||||||
|         add_library(${scoped_name} IMPORTED INTERFACE) |         add_library(${scoped_name} IMPORTED INTERFACE) | ||||||
|         set_target_properties(${scoped_name} |         set_target_properties(${scoped_name} | ||||||
|                           PROPERTIES INTERFACE_LINK_LIBRARIES ${imported_name}) |                               PROPERTIES INTERFACE_LINK_LIBRARIES | ||||||
|  |                               ${imported_name}) | ||||||
|  |     endif () | ||||||
| endforeach () | endforeach () | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue