Browse Source

Another attempt to fix configuration for multiple Urho3D libs found.
[ci skip]

Yao Wei Tjong 姚伟忠 12 năm trước cách đây
mục cha
commit
5a162b8551

+ 1 - 1
Source/CMake/Modules/FindUrho3D.cmake

@@ -142,7 +142,7 @@ endif ()
 
 if (WIN32)
     set (URHO3D_LIBRARIES_REL ${URHO3D_LIBRARIES})
-    set (URHO3D_LIBRARIES ${URHO3D_LIBRARIES} ${URHO3D_LIBRARIES_DBG})
+    list (APPEND URHO3D_LIBRARIES ${URHO3D_LIBRARIES_DBG})
 endif ()
 
 if (URHO3D_INCLUDE_DIRS AND URHO3D_LIBRARIES)

+ 3 - 8
Source/CMake/Modules/Urho3D-CMake-magic.cmake

@@ -609,14 +609,9 @@ macro (define_dependency_libs TARGET)
         # This variable value can either be 'Urho3D' target or an absolute path to an actual static/shared Urho3D library or empty (if we are building the library itself)
         # The former would cause CMake not only to link against the Urho3D library but also to add a dependency to Urho3D target
         if (URHO3D_LIBRARIES)
-            if (WIN32 AND IS_ABSOLUTE ${URHO3D_LIBRARIES} AND TARGET ${TARGET_NAME})
-                if (URHO3D_LIBRARIES_DBG)
-                    set (WIN32_LIBS debug ${URHO3D_LIBRARIES_DBG})
-                endif ()
-                if (URHO3D_LIBRARIES_REL)
-                    list (APPEND WIN32_LIBS optimized ${URHO3D_LIBRARIES_REL})
-                endif ()
-                target_link_libraries (${TARGET_NAME} ${WIN32_LIBS})
+            if (WIN32 AND URHO3D_LIBRARIES_DBG AND URHO3D_LIBRARIES_REL AND TARGET ${TARGET_NAME})
+                # Special handling when both debug and release libraries are being found
+                target_link_libraries (${TARGET_NAME} debug ${URHO3D_LIBRARIES_DBG} optimized ${URHO3D_LIBRARIES_REL})
             else ()
                 list (APPEND ABSOLUTE_PATH_LIBS ${URHO3D_LIBRARIES})
             endif ()