Open charliehuge opened 2 years ago
Perhaps you could try this:
Not clear to me whether this is still a problematic issue or not. If I don't see further discussion, I'll close it then next time I cull the issues list.
@garyscavone set(RTAUDIO_TARGETNAME_UNINSTALL "uninstall_rtaudio" ...
solves the current issue for me.
If anybody after me will face error:
add_custom_target cannot create target "uninstall" because another target with the same name already exists.
This can be fixed with the following lines in your CMakeLists.txt:
set(RTAUDIO_BUILD_TESTING OFF CACHE INTERNAL "RTAudio: Build without tests")
set(RTAUDIO_TARGETNAME_UNINSTALL "uninstall_rtaudio" CACHE INTERNAL "RTAudio: change uninstall target name" FORCE)
add_subdirectory("lib/rtaudio" "rtaudio")
set(RTMIDI_BUILD_TESTING OFF CACHE INTERNAL "RTMidi: Build without tests")
set(RTMIDI_TARGETNAME_UNINSTALL "uninstall_rtmidi" CACHE INTERNAL "RTMidi: change uninstall target name" FORCE)
add_subdirectory("lib/rtmidi" "rtmidi")
I think the current issue can be closed, but documentation is needed for using rtmidi and rtaudio in the same project.
It would be nice to have an option to disable the uninstall target completely, I could make a PR for that if there's interest 👍
I was using rtmidi in a CMake project using FetchContent like this:
This worked fine until I wanted to also include rtaudio. If I do the same as above to get rtaudio and make it available to my targets, I get an error like this:
I can get around this by including rtaudio and rtmidi directly in my project as submodules, then modifying the CMakeLists.txt for each library to either change the names or just remove the targets (I don't need them). But now I have a fork of each library to maintain just to use both things.
First off, am I missing something obvious? If not, how do users of both libraries typically handle this?