mirror of
				https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
				synced 2025-11-03 20:18:06 +00:00 
			
		
		
		
	Check for existing custom target: uninstall
When including `cppkafka` in a CMake project containing other project defining the same target (`curl`, specifically, which defines the same target [here](3ea7679057/CMakeLists.txt (L1293))) I get the foollowing error:
```
add_custom_target cannot create target "uninstall" because another target  with the same name already exists
```
This if condition fixes the issue.
			
			
This commit is contained in:
		@@ -86,13 +86,15 @@ else()
 | 
			
		||||
    message(STATUS "Disabling tests")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# Confiugure the uninstall script
 | 
			
		||||
configure_file(
 | 
			
		||||
    "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
 | 
			
		||||
    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
 | 
			
		||||
    IMMEDIATE @ONLY
 | 
			
		||||
)
 | 
			
		||||
if(NOT TARGET uninstall)
 | 
			
		||||
    # Confiugure the uninstall script
 | 
			
		||||
    configure_file(
 | 
			
		||||
        "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
 | 
			
		||||
        "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
 | 
			
		||||
        IMMEDIATE @ONLY
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
# Add uninstall target
 | 
			
		||||
add_custom_target(uninstall
 | 
			
		||||
    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
 | 
			
		||||
    # Add uninstall target
 | 
			
		||||
    add_custom_target(uninstall
 | 
			
		||||
        COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
 | 
			
		||||
endif()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user