0029396: Configuration, Cmake: restore 3rd-party libraries into INTERFACE_LINK_LIBRAR...
[occt.git] / adm / cmake / occt_toolkit.cmake
index 60b0fe6..323b538 100644 (file)
@@ -214,11 +214,9 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
     string (REGEX MATCH "^TK" TK_FOUND ${USED_ITEM})
     string (REGEX MATCH "^vtk" VTK_FOUND ${USED_ITEM})
     
-    if (NOT "${TK_FOUND}" STREQUAL "")
+    if (NOT "${TK_FOUND}" STREQUAL "" OR NOT "${VTK_FOUND}" STREQUAL "")
       list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT ${USED_ITEM})
-    elseif (NOT "${VTK_FOUND}" STREQUAL "")
-      list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${USED_ITEM})
-      if (BUILD_SHARED_LIBS AND INSTALL_VTK AND COMMAND OCCT_INSTALL_VTK)
+      if (NOT "${VTK_FOUND}" STREQUAL "" AND BUILD_SHARED_LIBS AND INSTALL_VTK AND COMMAND OCCT_INSTALL_VTK)
         OCCT_INSTALL_VTK(${USED_ITEM})
       endif()
     else()
@@ -281,29 +279,28 @@ endif()
 if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2")
   add_definitions(-DVTK_OPENGL2_BACKEND)
   foreach (VTK_EXCLUDE_LIBRARY vtkRenderingOpenGL vtkRenderingFreeTypeOpenGL)
-    list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
+    list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
     if (NOT ${IS_VTK_OPENGL_FOUND} EQUAL -1)
-      list (REMOVE_ITEM USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
+      list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
       if (${VTK_EXCLUDE_LIBRARY} STREQUAL vtkRenderingOpenGL)
-        list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
+        list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
         if(VTK_MAJOR_VERSION GREATER 6)
-          list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT vtkRenderingGL2PSOpenGL2)
+          list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingGL2PSOpenGL2)
         endif()
       endif()
     endif()
   endforeach()
 else()
   if(VTK_MAJOR_VERSION EQUAL 6 AND VTK_MINOR_VERSION GREATER 2 OR VTK_MAJOR_VERSION GREATER 6)
-    list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL" IS_VTK_RENDER_FREETYPE_FOUND)
+    list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL" IS_VTK_RENDER_FREETYPE_FOUND)
     if (NOT ${IS_VTK_RENDER_FREETYPE_FOUND} EQUAL -1)
-      list (REMOVE_ITEM USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL")
+      list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL")
     endif()
   endif()
 endif()
 
 if (BUILD_SHARED_LIBS)
-  target_link_libraries (${PROJECT_NAME} PUBLIC ${USED_TOOLKITS_BY_CURRENT_PROJECT})
-  target_link_libraries (${PROJECT_NAME} PRIVATE ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
+  target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
 endif()
 
 # suppress deprecation warnings inside OCCT itself for old gcc versions with unavailable Standard_DISABLE_DEPRECATION_WARNINGS