소스 검색

only create uninstall target when raylib is top level

Duy Tran 3 달 전
부모
커밋
629d4c1721
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      CMakeLists.txt

+ 3 - 2
CMakeLists.txt

@@ -46,8 +46,9 @@ endif()
 # Main sources directory (the second parameter sets the output directory name to raylib)
 # Main sources directory (the second parameter sets the output directory name to raylib)
 add_subdirectory(src raylib)
 add_subdirectory(src raylib)
 
 
-# Uninstall target
-if(NOT TARGET uninstall)
+# Uninstall target, only create when building raylib by itself
+# Avoid conflicting target names when using raylib with other libraries
+if(NOT TARGET uninstall AND PROJECT_IS_TOP_LEVEL)
   configure_file(
   configure_file(
     "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Uninstall.cmake"
     "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Uninstall.cmake"
     "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
     "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"