Skip to content

Commit

Permalink
Only create uninstall target if it does not exist
Browse files Browse the repository at this point in the history
In case librtlsdr is included as a subdirectory into another cmake
project the uninstall target may already be set and causes cmake
to fail. In a standalone build the check this patch adds does not
alter the behaviour.

(cherry picked from commit 0990db4247f16878d4f2765dd7d545080574ca79)
  • Loading branch information
johanhedin authored and hayguen committed Mar 21, 2024
1 parent b45281b commit 537d2c5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,17 @@ include_directories(
########################################################################
# Create uninstall target
########################################################################
configure_file(
${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
@ONLY)

add_custom_target(uninstall
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
if(NOT TARGET uninstall)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
@ONLY
)

add_custom_target(uninstall
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
endif()

########################################################################
# Install udev rules
Expand Down

0 comments on commit 537d2c5

Please sign in to comment.