mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-20 19:54:51 +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")
|
message(STATUS "Disabling tests")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Confiugure the uninstall script
|
if(NOT TARGET uninstall)
|
||||||
configure_file(
|
# Confiugure the uninstall script
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
configure_file(
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
||||||
IMMEDIATE @ONLY
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||||
)
|
IMMEDIATE @ONLY
|
||||||
|
)
|
||||||
|
|
||||||
# Add uninstall target
|
# Add uninstall target
|
||||||
add_custom_target(uninstall
|
add_custom_target(uninstall
|
||||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||||
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user