mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-11-11 20:25:13 +00:00
Steve Robinson
In my project, the 'uninstall' target is already created by the glew library. I get this error when SDL2 tries to create it:
CMake Error at _build/3rdparty/SDL2/SDL2-2.0.6/CMakeLists.txt:1816 (add_custom_target):
add_custom_target cannot create target "uninstall" because another target
with the same name already exists. The existing target is a custom target
created in source directory
"D:/Code/sdl2-tutorial/_build/3rdparty/glew/glew-2.1.0/build/cmake". See
documentation for policy CMP0002 for more details.
To fix it, go to the bottom of the SDL2 CMakeLists.txt file. Add an if statement to check for the existence of the target before creating it. The end result looks like this:
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
This is how the glew library deals with this possibility in their CMakeLists.txt file.
|
||
|---|---|---|
| acinclude | ||
| android-project | ||
| build-scripts | ||
| cmake | ||
| debian | ||
| docs | ||
| include | ||
| src | ||
| test | ||
| VisualC | ||
| VisualC-WinRT | ||
| visualtest | ||
| Xcode | ||
| Xcode-iOS | ||
| .hgignore | ||
| Android.mk | ||
| autogen.sh | ||
| BUGS.txt | ||
| cmake_uninstall.cmake.in | ||
| CMakeLists.txt | ||
| configure | ||
| configure.in | ||
| COPYING.txt | ||
| CREDITS.txt | ||
| INSTALL.txt | ||
| Makefile.in | ||
| Makefile.minimal | ||
| Makefile.pandora | ||
| Makefile.psp | ||
| Makefile.wiz | ||
| README-SDL.txt | ||
| README.txt | ||
| sdl2-config.cmake.in | ||
| sdl2-config.in | ||
| sdl2.m4 | ||
| sdl2.pc.in | ||
| SDL2.spec.in | ||
| SDL2Config.cmake | ||
| TODO.txt | ||
| VisualC.html | ||
| WhatsNew.txt | ||
Simple DirectMedia Layer
(SDL)
Version 2.0
---
https://www.libsdl.org/
Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games.
More extensive documentation is available in the docs directory, starting
with README.md
Enjoy!
Sam Lantinga (slouken@libsdl.org)