0029277: Configuration, Cmake - remove 3rd-party libraries from INTERFACE_LINK_LIBRAR...
authorski <ski@opencascade.com>
Tue, 31 Oct 2017 09:07:18 +0000 (12:07 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 1 Nov 2017 13:51:12 +0000 (16:51 +0300)
3rd-party libraries were removed from INTERFACE_LINK_LIBRARIES properties of OCCT targets.

adm/cmake/occt_toolkit.cmake

index 80e6a75..4c50df2 100644 (file)
@@ -211,9 +211,11 @@ 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 "" OR NOT "${VTK_FOUND}" STREQUAL "")
+    if (NOT "${TK_FOUND}" STREQUAL "")
       list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT ${USED_ITEM})
-      if (NOT "${VTK_FOUND}" STREQUAL "" AND BUILD_SHARED_LIBS AND INSTALL_VTK AND COMMAND OCCT_INSTALL_VTK)
+    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)
         OCCT_INSTALL_VTK(${USED_ITEM})
       endif()
     else()
@@ -276,28 +278,29 @@ endif()
 if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2")
   add_definitions(-DVTK_OPENGL2_BACKEND)
   foreach (VTK_EXCLUDE_LIBRARY vtkRenderingOpenGL vtkRenderingFreeTypeOpenGL)
-    list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
+    list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
     if (NOT ${IS_VTK_OPENGL_FOUND} EQUAL -1)
-      list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
+      list (REMOVE_ITEM USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
       if (${VTK_EXCLUDE_LIBRARY} STREQUAL vtkRenderingOpenGL)
-        list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
+        list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
         if(VTK_MAJOR_VERSION GREATER 6)
-          list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingGL2PSOpenGL2)
+          list (APPEND USED_EXTERNAL_LIBS_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_TOOLKITS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL" IS_VTK_RENDER_FREETYPE_FOUND)
+    list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL" IS_VTK_RENDER_FREETYPE_FOUND)
     if (NOT ${IS_VTK_RENDER_FREETYPE_FOUND} EQUAL -1)
-      list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL")
+      list (REMOVE_ITEM USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL")
     endif()
   endif()
 endif()
 
 if (BUILD_SHARED_LIBS)
-  target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
+  target_link_libraries (${PROJECT_NAME} PUBLIC ${USED_TOOLKITS_BY_CURRENT_PROJECT})
+  target_link_libraries (${PROJECT_NAME} PRIVATE ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
 endif()
 
 # suppress deprecation warnings inside OCCT itself for old gcc versions with unavailable Standard_DISABLE_DEPRECATION_WARNINGS