0027380: cmake should not try to link against 3rd-party libs when configuring a stati...
authorski <ski@opencascade.com>
Wed, 13 Apr 2016 09:38:17 +0000 (12:38 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 14 Apr 2016 09:57:53 +0000 (12:57 +0300)
Linking against 3rd-party libs when configuring a static OCCT build is eliminated.

math library is not linked if build is static

also: an info message is expanded by several words describing using of only header files of 3rdparties

Removed unnecessary for static build CMake gui variables

CMakeLists.txt
adm/cmake/3rdparty_macro.cmake
adm/cmake/freetype.cmake
adm/cmake/occt_csf.cmake
adm/cmake/occt_defs_flags.cmake
adm/cmake/occt_toolkit.cmake
adm/cmake/tbb.cmake
adm/cmake/tcl.cmake
adm/cmake/tk.cmake
adm/cmake/vtk.cmake

index 56bc0ff..b0851c1 100644 (file)
@@ -26,6 +26,7 @@ if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared")
   set (BUILD_SHARED_LIBS ON)
 else()
   unset (BUILD_SHARED_LIBS)
+  message (STATUS "Info: Only 3rdparty's header files are used for building of static OCCT libraries")
 endif()
 
 # the name of the project
@@ -579,7 +580,7 @@ endif()
 # include <cmake binary folder>/inc
 include_directories (${CMAKE_BINARY_DIR}/inc)
 
-if (3RDPARTY_LIBRARY_DIRS)
+if (3RDPARTY_LIBRARY_DIRS AND BUILD_SHARED_LIBS)
   list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
   string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
   message (STATUS "Info: The directories of 3rdparty libraries: \n\t${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")
index 887c343..8061ab1 100644 (file)
@@ -8,7 +8,7 @@ set(3RDPARTY_MACRO_ALREADY_INCLUDED 1)
 
 macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEBUG)
 
-  if (NOT DEFINED INSTALL_${PRODUCT_NAME})
+  if (NOT DEFINED INSTALL_${PRODUCT_NAME} AND BUILD_SHARED_LIBS)
     set (INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "${INSTALL_${PRODUCT_NAME}_DESCR}")
   endif()
 
@@ -37,47 +37,50 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
     set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR           "" CACHE PATH "the path of ${HEADER_NAME}")
   endif()
 
-  if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
-    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY               "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
-  endif()
+  if (BUILD_SHARED_LIBS)
+    if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
+      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY               "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
+    endif()
 
-  if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
-    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR           "" CACHE PATH "The directory containing ${PRODUCT_NAME} library")
-  endif()
+    if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
+      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR           "" CACHE PATH "The directory containing ${PRODUCT_NAME} library")
+    endif()
 
-  if (WIN32)
-    if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT 3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
-      set (3RDPARTY_${PRODUCT_NAME}_DLL                 "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
+    if (WIN32)
+      if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT 3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
+        set (3RDPARTY_${PRODUCT_NAME}_DLL                 "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
+      endif()
     endif()
-  endif()
 
-  if (WIN32)
-    if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
-      set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR             "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library")
+    if (WIN32)
+      if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
+        set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR             "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library")
+      endif()
     endif()
   endif()
 
   # check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_${PRODUCT_NAME}_DIR
   if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
     CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR PATH "the path to ${PRODUCT_NAME}")
-    CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY FILEPATH "the path to ${PRODUCT_NAME} library")
+    if (BUILD_SHARED_LIBS)
+      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY FILEPATH "the path to ${PRODUCT_NAME} library")
 
-    if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
-      get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
-      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
-    else()
-      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR PATH "The directory containing ${PRODUCT_NAME} library")
-    endif()
+      if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
+        get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
+        set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
+      else()
+        CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR PATH "The directory containing ${PRODUCT_NAME} library")
+      endif()
 
-    if (WIN32)
-      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL FILEPATH "the path to ${PRODUCT_NAME} shared library")
+      if (WIN32)
+        CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL FILEPATH "the path to ${PRODUCT_NAME} shared library")
 
-      if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
-        get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
-        set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
-      else()
-      
-      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR PATH "The directory containing ${PRODUCT_NAME} shared library")
+        if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
+          get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
+          set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
+        else()
+          CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR PATH "The directory containing ${PRODUCT_NAME} shared library")
+        endif()
       endif()
     endif()
   endif()
@@ -109,156 +112,158 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
     set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE FILEPATH "The path to ${HEADER_NAME}" FORCE)
   endif()
 
-  # library
-  if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
-    set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
+  if (BUILD_SHARED_LIBS)
+    # library
+    if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
+      set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
 
-    set (${PRODUCT_NAME}_PATH_SUFFIXES lib)
-    if (ANDROID)
-      set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} libs/${ANDROID_ABI})
-    endif()
-
-    # set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
-    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
-
-    if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
-      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME}
-                                                     PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
-                                                     PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
-                                                     CMAKE_FIND_ROOT_PATH_BOTH
-                                                     NO_DEFAULT_PATH)
-    else()
-      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME} 
-                                                     PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
-                                                     CMAKE_FIND_ROOT_PATH_BOTH)
-    endif()
-
-    if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
-      get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
-      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
-    else()
-      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
-    endif()
-  endif()
-
-  if (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
-    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
-  else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
-
-    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
-  endif()
-
-  # shared library
-  if (WIN32)
-    if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
-      
-      set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
+      set (${PRODUCT_NAME}_PATH_SUFFIXES lib)
+      if (ANDROID)
+        set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} libs/${ANDROID_ABI})
+      endif()
 
-      # set 3RDPARTY_${PRODUCT_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_DLL
-      set (3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} shared library" FORCE)
+      # set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
+      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
 
       if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
-        find_library (3RDPARTY_${PRODUCT_NAME}_DLL  NAMES ${LIBRARY_NAME}
-                                                    PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}"
-                                                    PATH_SUFFIXES bin
-                                                    NO_DEFAULT_PATH)
+        find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME}
+                                                       PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
+                                                       PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
+                                                       CMAKE_FIND_ROOT_PATH_BOTH
+                                                       NO_DEFAULT_PATH)
       else()
-        find_library (3RDPARTY_${PRODUCT_NAME}_DLL NAMES ${LIBRARY_NAME} PATH_SUFFIXES bin)
+        find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY NAMES ${LIBRARY_NAME} 
+                                                       PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
+                                                       CMAKE_FIND_ROOT_PATH_BOTH)
       endif()
 
-      if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
-        get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
-        set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
+      if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
+        get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
+        set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
       else()
-        set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
-
-        set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
+        set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
       endif()
     endif()
 
-    if (3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
-      list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
+    if (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
+      list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
     else()
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
+      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
+
+      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
     endif()
-  endif()
 
-  set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "")
+    # shared library
+    if (WIN32)
+      if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
 
-  if (INSTALL_${PRODUCT_NAME})
-    OCCT_MAKE_OS_WITH_BITNESS()
-    OCCT_MAKE_COMPILER_SHORT_NAME()
+        set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
 
-    if (WIN32)
-      if (SINGLE_GENERATOR)
-        install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
-      else()
-        install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
-                 CONFIGURATIONS Release
-                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
-        install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
-                 CONFIGURATIONS RelWithDebInfo
-                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
-        install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
-                 CONFIGURATIONS Debug
-                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
-      endif()
-    else()
-      get_filename_component(ABS_PATH ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} REALPATH)
+        # set 3RDPARTY_${PRODUCT_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_DLL
+        set (3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} shared library" FORCE)
 
-      if ("${PRODUCT_NAME}" STREQUAL "FREEIMAGE")
-        get_filename_component(FREEIMLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
+        if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
+          find_library (3RDPARTY_${PRODUCT_NAME}_DLL  NAMES ${LIBRARY_NAME}
+                                                      PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}"
+                                                      PATH_SUFFIXES bin
+                                                      NO_DEFAULT_PATH)
+        else()
+          find_library (3RDPARTY_${PRODUCT_NAME}_DLL NAMES ${LIBRARY_NAME} PATH_SUFFIXES bin)
+        endif()
 
-        if (SINGLE_GENERATOR)
-          install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${FREEIMLIB}.3)
+        if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
+          get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
+          set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
         else()
-          install (FILES "${ABS_PATH}"
-                   CONFIGURATIONS Release
-                   DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
-                   RENAME ${FREEIMLIB}.3)
-          install (FILES "${ABS_PATH}"
-                   CONFIGURATIONS RelWithDebInfo
-                   DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
-                   RENAME ${FREEIMLIB}.3)
-          install (FILES "${ABS_PATH}"
-                   CONFIGURATIONS Debug
-                   DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
-                   RENAME ${FREEIMLIB}.3)
+          set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
+
+          set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
         endif()
       endif()
 
-      if("${PRODUCT_NAME}" STREQUAL "GL2PS")
-        get_filename_component(GL2PSLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
+      if (3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
+        list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
+      else()
+        list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
+      endif()
+    endif()
+
+    set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "")
+
+    if (INSTALL_${PRODUCT_NAME})
+      OCCT_MAKE_OS_WITH_BITNESS()
+      OCCT_MAKE_COMPILER_SHORT_NAME()
 
+      if (WIN32)
         if (SINGLE_GENERATOR)
-          install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${GL2PSLIB}.1)
+          install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
         else()
-          install (FILES "${ABS_PATH}"
+          install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
                    CONFIGURATIONS Release
-                   DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
-                   RENAME ${GL2PSLIB}.1)
-          install (FILES "${ABS_PATH}"
+                   DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
+          install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
                    CONFIGURATIONS RelWithDebInfo
-                   DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
-                   RENAME ${GL2PSLIB}.1)
-          install (FILES "${ABS_PATH}"
+                   DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
+          install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
                    CONFIGURATIONS Debug
-                   DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
-                   RENAME ${GL2PSLIB}.1)
+                   DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
+        endif()
+      else()
+        get_filename_component(ABS_PATH ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} REALPATH)
+
+        if ("${PRODUCT_NAME}" STREQUAL "FREEIMAGE")
+          get_filename_component(FREEIMLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
+
+          if (SINGLE_GENERATOR)
+            install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${FREEIMLIB}.3)
+          else()
+            install (FILES "${ABS_PATH}"
+                     CONFIGURATIONS Release
+                     DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
+                     RENAME ${FREEIMLIB}.3)
+            install (FILES "${ABS_PATH}"
+                     CONFIGURATIONS RelWithDebInfo
+                     DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
+                     RENAME ${FREEIMLIB}.3)
+            install (FILES "${ABS_PATH}"
+                     CONFIGURATIONS Debug
+                     DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
+                     RENAME ${FREEIMLIB}.3)
+          endif()
+        endif()
+
+        if("${PRODUCT_NAME}" STREQUAL "GL2PS")
+          get_filename_component(GL2PSLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
+
+          if (SINGLE_GENERATOR)
+            install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}" RENAME ${GL2PSLIB}.1)
+          else()
+            install (FILES "${ABS_PATH}"
+                     CONFIGURATIONS Release
+                     DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
+                     RENAME ${GL2PSLIB}.1)
+            install (FILES "${ABS_PATH}"
+                     CONFIGURATIONS RelWithDebInfo
+                     DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
+                     RENAME ${GL2PSLIB}.1)
+            install (FILES "${ABS_PATH}"
+                     CONFIGURATIONS Debug
+                     DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
+                     RENAME ${GL2PSLIB}.1)
+          endif()
         endif()
       endif()
-    endif()
-  else()
-    # the library directory for using by the executable
-    if (WIN32)
-      set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
     else()
-      set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
+      # the library directory for using by the executable
+      if (WIN32)
+        set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
+      else()
+        set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
+      endif()
     endif()
-  endif()
 
-  mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
+    mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
+  endif()
 endmacro()
 
 macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
@@ -272,48 +277,52 @@ macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
       set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
     endif()
 
-    # library dir
-    set (DOES_PATH_CONTAIN FALSE)
-    if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
-      string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
-    endif()
-    if (NOT DOES_PATH_CONTAIN)
-      set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
-    endif()
-
-    # shared library dir
-    if (WIN32)
+    if (BUILD_SHARED_LIBS)
+      # library dir
       set (DOES_PATH_CONTAIN FALSE)
-      if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-        string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+      if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
+        string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
       endif()
       if (NOT DOES_PATH_CONTAIN)
-        set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
+        set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
       endif()
-    endif()
-  endif()
 
-  # check library
-  set (DOES_PATH_CONTAIN FALSE)
-  if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
-    if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
-      string (REGEX MATCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY}")
+      # shared library dir
+      if (WIN32)
+        set (DOES_PATH_CONTAIN FALSE)
+        if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+          string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+        endif()
+        if (NOT DOES_PATH_CONTAIN)
+          set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
+        endif()
+      endif()
     endif()
   endif()
-  if (NOT DOES_PATH_CONTAIN)
-    set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
-  endif()
 
-  # check shared library
-  if (WIN32)
+  if (BUILD_SHARED_LIBS)
+    # check library
     set (DOES_PATH_CONTAIN FALSE)
-    if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-      if (3RDPARTY_${LIBNAME}_DLL AND EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
-        string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DLL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL}")
+    if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
+      if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
+        string (REGEX MATCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY}")
       endif()
     endif()
     if (NOT DOES_PATH_CONTAIN)
-      set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
+      set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
+    endif()
+
+    # check shared library
+    if (WIN32)
+      set (DOES_PATH_CONTAIN FALSE)
+      if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+        if (3RDPARTY_${LIBNAME}_DLL AND EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
+          string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DLL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL}")
+        endif()
+      endif()
+      if (NOT DOES_PATH_CONTAIN)
+        set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
+      endif()
     endif()
   endif()
 endmacro()
index 865caf6..63720e1 100644 (file)
@@ -1,6 +1,6 @@
 # freetype
 
-if (NOT DEFINED INSTALL_FREETYPE)
+if (NOT DEFINED INSTALL_FREETYPE AND BUILD_SHARED_LIBS)
   set (INSTALL_FREETYPE OFF CACHE BOOL "${INSTALL_FREETYPE_DESCR}")
 endif()
 
@@ -37,23 +37,25 @@ if (NOT DEFINED 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
   set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "" CACHE FILEPATH "the path of freetype2")
 endif()
 
-if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY OR NOT 3RDPARTY_FREETYPE_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
-  set (3RDPARTY_FREETYPE_LIBRARY               "" CACHE FILEPATH "freetype library" FORCE)
-endif()
+if (BUILD_SHARED_LIBS)
+  if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY OR NOT 3RDPARTY_FREETYPE_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
+    set (3RDPARTY_FREETYPE_LIBRARY               "" CACHE FILEPATH "freetype library" FORCE)
+  endif()
 
-if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY_DIR)
-  set (3RDPARTY_FREETYPE_LIBRARY_DIR           "" CACHE PATH "The directory containing freetype library")
-endif()
+  if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY_DIR)
+    set (3RDPARTY_FREETYPE_LIBRARY_DIR           "" CACHE PATH "The directory containing freetype library")
+  endif()
 
-if (WIN32)
-  if (NOT DEFINED 3RDPARTY_FREETYPE_DLL OR NOT 3RDPARTY_FREETYPE_DLL_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
-    set (3RDPARTY_FREETYPE_DLL                 "" CACHE FILEPATH "freetype shared library" FORCE)
+  if (WIN32)
+    if (NOT DEFINED 3RDPARTY_FREETYPE_DLL OR NOT 3RDPARTY_FREETYPE_DLL_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
+      set (3RDPARTY_FREETYPE_DLL                 "" CACHE FILEPATH "freetype shared library" FORCE)
+    endif()
   endif()
-endif()
 
-if (WIN32)
-  if (NOT DEFINED 3RDPARTY_FREETYPE_DLL_DIR)
-    set (3RDPARTY_FREETYPE_DLL_DIR               "" CACHE PATH "The directory containing freetype shared library")
+  if (WIN32)
+    if (NOT DEFINED 3RDPARTY_FREETYPE_DLL_DIR)
+      set (3RDPARTY_FREETYPE_DLL_DIR               "" CACHE PATH "The directory containing freetype shared library")
+    endif()
   endif()
 endif()
 
@@ -61,24 +63,25 @@ endif()
 if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
   CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
   CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
-  CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY FILEPATH "the path to freetype library")
+  if (BUILD_SHARED_LIBS)
+    CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY FILEPATH "the path to freetype library")
 
-  if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
-    get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
-    set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
-  else()
-    CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY_DIR PATH "The directory containing freetype library")
-  endif()
+    if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
+      get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
+      set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
+    else()
+      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY_DIR PATH "The directory containing freetype library")
+    endif()
 
-  if (WIN32)
-    CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL FILEPATH "the path to freetype shared library")
+    if (WIN32)
+      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL FILEPATH "the path to freetype shared library")
 
-    if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
-      get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
-      set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype shared library" FORCE)
-    else()
-    
-    CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL_DIR PATH "The directory containing freetype shared library")
+      if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
+        get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
+        set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype shared library" FORCE)
+      else()
+        CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL_DIR PATH "The directory containing freetype shared library")
+      endif()
     endif()
   endif()
 endif()
@@ -118,7 +121,9 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
   if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
     CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
     CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
-    CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
+    if (BUILD_SHARED_LIBS)
+      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
+    endif()
   endif()
 
   # assign the found paths to corresponding 3RDPARTY_FREETYPE_ variables
@@ -134,17 +139,19 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
     endif()
   endif()
 
-  if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
-    if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
-      set (3RDPARTY_FREETYPE_LIBRARY  "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
+  if (BUILD_SHARED_LIBS)
+    if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
+      if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
+        set (3RDPARTY_FREETYPE_LIBRARY  "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
+      endif()
     endif()
-  endif()
 
-  if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
-    get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
-    set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
-  else()
-    set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
+    if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
+      get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
+      set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
+    else()
+      set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
+    endif()
   endif()
 endif()
 
@@ -211,131 +218,132 @@ else()
 endif()
 
 # freetype library
-if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
-  set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
-
-  set (FREETYPE_PATH_SUFFIXES lib)
-  if (ANDROID)
-    set (FREETYPE_PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES} libs/${ANDROID_ABI})
-  endif()
-
-  # set 3RDPARTY_FREETYPE_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_LIBRARY
-  set (3RDPARTY_FREETYPE_LIBRARY "3RDPARTY_FREETYPE_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to freetype library" FORCE)
-
-  if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
-    find_library (3RDPARTY_FREETYPE_LIBRARY freetype
-                                            PATHS "${3RDPARTY_FREETYPE_LIBRARY_DIR}" "${3RDPARTY_FREETYPE_DIR}"
-                                            PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
-                                            CMAKE_FIND_ROOT_PATH_BOTH
-                                            NO_DEFAULT_PATH)
-  else()
-    find_library (3RDPARTY_FREETYPE_LIBRARY freetype 
-                                            PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
-                                            CMAKE_FIND_ROOT_PATH_BOTH)
-  endif()
-
-  if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
-    get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
-    set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
-  else()
-    set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
-  endif()
-endif()
-
-if (3RDPARTY_FREETYPE_LIBRARY_DIR AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
-  list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
-else()
-  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_LIBRARY_DIR)
-
-  set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "The path to freetype library" FORCE)
-endif()
+if (BUILD_SHARED_LIBS)
+  if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
+    set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
 
-# freetype shared library
-if (WIN32)
-  if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
-    
-    set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
+    set (FREETYPE_PATH_SUFFIXES lib)
+    if (ANDROID)
+      set (FREETYPE_PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES} libs/${ANDROID_ABI})
+    endif()
 
-    # set 3RDPARTY_FREETYPE_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_DLL
-    set (3RDPARTY_FREETYPE_DLL "3RDPARTY_FREETYPE_DLL-NOTFOUND" CACHE FILEPATH "The path to freetype shared library" FORCE)
+    # set 3RDPARTY_FREETYPE_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_LIBRARY
+    set (3RDPARTY_FREETYPE_LIBRARY "3RDPARTY_FREETYPE_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to freetype library" FORCE)
 
     if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
-      find_library (3RDPARTY_FREETYPE_DLL freetype
-                                          PATHS "${3RDPARTY_FREETYPE_DIR}"
-                                          PATH_SUFFIXES bin
-                                          NO_DEFAULT_PATH)
+      find_library (3RDPARTY_FREETYPE_LIBRARY freetype
+                                              PATHS "${3RDPARTY_FREETYPE_LIBRARY_DIR}" "${3RDPARTY_FREETYPE_DIR}"
+                                              PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
+                                              CMAKE_FIND_ROOT_PATH_BOTH
+                                              NO_DEFAULT_PATH)
     else()
-      find_library (3RDPARTY_FREETYPE_DLL freetype
-                                          PATH_SUFFIXES bin)
+      find_library (3RDPARTY_FREETYPE_LIBRARY freetype 
+                                              PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
+                                              CMAKE_FIND_ROOT_PATH_BOTH)
     endif()
 
-    if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
-      get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
-      set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
+    if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
+      get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
+      set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
     else()
-      set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library" FORCE)
-
-      set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
+      set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
     endif()
   endif()
 
-  if (3RDPARTY_FREETYPE_DLL_DIR OR EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
-    list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_FREETYPE_DLL_DIR}")
+  if (3RDPARTY_FREETYPE_LIBRARY_DIR AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
+    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_DLL_DIR)
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_LIBRARY_DIR)
+
+    set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "The path to freetype library" FORCE)
   endif()
-endif()
 
+  # freetype shared library
+  if (WIN32)
+    if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
+
+      set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
 
-# install instructions
-if (INSTALL_FREETYPE)
-  OCCT_MAKE_OS_WITH_BITNESS()
+      # set 3RDPARTY_FREETYPE_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_DLL
+      set (3RDPARTY_FREETYPE_DLL "3RDPARTY_FREETYPE_DLL-NOTFOUND" CACHE FILEPATH "The path to freetype shared library" FORCE)
 
-  if (WIN32)
-    if (SINGLE_GENERATOR)
-      install (FILES "${3RDPARTY_FREETYPE_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
-    else()
-      install (FILES "${3RDPARTY_FREETYPE_DLL}"
-               CONFIGURATIONS Release
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
-      install (FILES "${3RDPARTY_FREETYPE_DLL}"
-               CONFIGURATIONS RelWithDebInfo
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
-      install (FILES "${3RDPARTY_FREETYPE_DLL}"
-               CONFIGURATIONS Debug
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
+      if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
+        find_library (3RDPARTY_FREETYPE_DLL freetype
+                                            PATHS "${3RDPARTY_FREETYPE_DIR}"
+                                            PATH_SUFFIXES bin
+                                            NO_DEFAULT_PATH)
+      else()
+        find_library (3RDPARTY_FREETYPE_DLL freetype
+                                            PATH_SUFFIXES bin)
+      endif()
+
+      if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
+        get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
+        set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
+      else()
+        set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library" FORCE)
+
+        set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
+      endif()
     endif()
-  else()
-    get_filename_component(3RDPARTY_FREETYPE_LIBRARY_ABS ${3RDPARTY_FREETYPE_LIBRARY} REALPATH)
-    get_filename_component(3RDPARTY_FREETYPE_LIBRARY_NAME ${3RDPARTY_FREETYPE_LIBRARY} NAME)
 
-    if (SINGLE_GENERATOR)
-      install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
-               RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
+    if (3RDPARTY_FREETYPE_DLL_DIR OR EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
+      list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_FREETYPE_DLL_DIR}")
     else()
-      install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
-               CONFIGURATIONS Release
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
-               RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
-      install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
-               CONFIGURATIONS RelWithDebInfo
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
-               RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
-      install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
-               CONFIGURATIONS Debug
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
-               RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
+      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_DLL_DIR)
     endif()
   endif()
 
-  set (USED_3RDPARTY_FREETYPE_DIR "")
-else()
-  # the library directory for using by the executable
-  if (WIN32)
-    set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR})
+  # install instructions
+  if (INSTALL_FREETYPE)
+    OCCT_MAKE_OS_WITH_BITNESS()
+
+    if (WIN32)
+      if (SINGLE_GENERATOR)
+        install (FILES "${3RDPARTY_FREETYPE_DLL}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
+      else()
+        install (FILES "${3RDPARTY_FREETYPE_DLL}"
+                 CONFIGURATIONS Release
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
+        install (FILES "${3RDPARTY_FREETYPE_DLL}"
+                 CONFIGURATIONS RelWithDebInfo
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
+        install (FILES "${3RDPARTY_FREETYPE_DLL}"
+                 CONFIGURATIONS Debug
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
+      endif()
+    else()
+      get_filename_component(3RDPARTY_FREETYPE_LIBRARY_ABS ${3RDPARTY_FREETYPE_LIBRARY} REALPATH)
+      get_filename_component(3RDPARTY_FREETYPE_LIBRARY_NAME ${3RDPARTY_FREETYPE_LIBRARY} NAME)
+
+      if (SINGLE_GENERATOR)
+        install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
+                 RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
+      else()
+        install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
+                 CONFIGURATIONS Release
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
+                 RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
+        install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
+                 CONFIGURATIONS RelWithDebInfo
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
+                 RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
+        install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
+                 CONFIGURATIONS Debug
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
+                 RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
+      endif()
+    endif()
+
+    set (USED_3RDPARTY_FREETYPE_DIR "")
   else()
-    set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
+    # the library directory for using by the executable
+    if (WIN32)
+      set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR})
+    else()
+      set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
+    endif()
   endif()
 endif()
 
@@ -344,4 +352,12 @@ OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
 OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
 OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
 
-mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
+if (BUILD_SHARED_LIBS)
+  mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
+else()
+  OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_DLL)
+  OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_DLL_DIR)
+  OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_LIBRARY)
+  OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_LIBRARY_DIR)
+  OCCT_CHECK_AND_UNSET(INSTALL_FREETYPE)
+endif()
index 08b2cf1..ebc505a 100644 (file)
@@ -10,7 +10,7 @@ if (NOT DEFINED USE_TCL)
   OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
 endif()
 
-if (USE_TCL)
+if (USE_TCL AND BUILD_SHARED_LIBS)
   if ("${3RDPARTY_TCL_LIBRARY_VERSION}" STREQUAL "")
     message (STATUS "Warning: TCL version has not been specified by CSF_TclLibs defining thus it will be used as 8.6")
     set (3RDPARTY_TCL_LIBRARY_VERSION "8.6")
index b43cd65..bd9dfba 100644 (file)
@@ -104,10 +104,6 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP
     elseif(NOT WIN32)
       set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
     endif()
-  else()
-    if (NOT ANDROID AND NOT MINGW)
-      set (CMAKE_STATIC_LINKER_FLAGS "-lm ${CMAKE_SHARED_STATIC_FLAGS}")
-    endif()
   endif()
 endif()
 
index 9e87057..a7cd3b9 100644 (file)
@@ -216,4 +216,6 @@ if (APPLE)
   endif()
 endif()
 
-target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
+if (BUILD_SHARED_LIBS)
+  target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
+endif()
index aba4a10..be418a2 100644 (file)
@@ -1,6 +1,6 @@
 # tbb
 
-if (NOT DEFINED INSTALL_TBB)
+if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
   set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
 endif()
 
@@ -9,7 +9,7 @@ if (NOT DEFINED 3RDPARTY_TBB_DIR)
   set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
 endif()
 
-if (MSVC)
+if (MSVC AND BUILD_SHARED_LIBS)
   add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE)
   add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE)
 endif()
@@ -275,18 +275,18 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
   mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
 endmacro()
 
+if (BUILD_SHARED_LIBS)
+  TBB_PRODUCT_SEARCH (TBB)
+  TBB_PRODUCT_SEARCH (TBBMALLOC)
 
-TBB_PRODUCT_SEARCH (TBB)
-TBB_PRODUCT_SEARCH (TBBMALLOC)
-
-
-if (INSTALL_TBB)
-  set (USED_3RDPARTY_TBB_DIR "")
-else()
-  # the library directory for using by the executable
-  if (WIN32)
-    set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
+  if (INSTALL_TBB)
+    set (USED_3RDPARTY_TBB_DIR "")
   else()
-    set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
+    # the library directory for using by the executable
+    if (WIN32)
+      set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
+    else()
+      set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
+    endif()
   endif()
-endif()
+endif()
\ No newline at end of file
index 08df381..2d6e9f0 100644 (file)
@@ -1,6 +1,6 @@
 # tcl
 
-if (NOT DEFINED INSTALL_TCL)
+if (NOT DEFINED INSTALL_TCL AND BUILD_SHARED_LIBS)
   set (INSTALL_TCL OFF CACHE BOOL "${INSTALL_TCL_DESCR}")
 endif()
 
@@ -14,26 +14,28 @@ if (NOT DEFINED 3RDPARTY_TCL_INCLUDE_DIR)
   set (3RDPARTY_TCL_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tcl")
 endif()
 
-# tcl library file (with absolute path)
-if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
-  set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library"  FORCE)
-endif()
+if (BUILD_SHARED_LIBS)
+  # tcl library file (with absolute path)
+  if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
+    set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library"  FORCE)
+  endif()
 
-# tcl library directory
-if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
-  set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
-endif()
+  # tcl library directory
+  if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
+    set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
+  endif()
 
-# tcl shared library (with absolute path)
-if (WIN32)
-  if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
-    set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
+  # tcl shared library (with absolute path)
+  if (WIN32)
+    if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
+      set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
+    endif()
   endif()
-endif()
 
-# tcl shared library directory
-if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
-  set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
+  # tcl shared library directory
+  if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
+    set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
+  endif()
 endif()
 
 # search for tcl in user defined directory
@@ -62,200 +64,204 @@ if (NOT 3RDPARTY_TCL_INCLUDE_DIR)
   endif()
 endif()
 
-# tcl dir and library
-if (NOT 3RDPARTY_TCL_LIBRARY)
-  if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}")
-    set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE)
+if (BUILD_SHARED_LIBS)
+  # tcl dir and library
+  if (NOT 3RDPARTY_TCL_LIBRARY)
+    if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}")
+      set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE)
 
-    if (NOT 3RDPARTY_TCL_LIBRARY_DIR)
-      get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
-      set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
+      if (NOT 3RDPARTY_TCL_LIBRARY_DIR)
+        get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
+        set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
+      endif()
     endif()
   endif()
-endif()
 
 
-if (WIN32)
-  if (NOT 3RDPARTY_TCL_DLL)
-    set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
-
-    set (DLL_FOLDER_FOR_SEARCH "")
-    if (3RDPARTY_TCL_DLL_DIR)
-      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
-    elseif (3RDPARTY_TCL_DIR)
-      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
-    elseif (3RDPARTY_TCL_LIBRARY_DIR)
-      get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
-      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
+  if (WIN32)
+    if (NOT 3RDPARTY_TCL_DLL)
+      set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
+
+      set (DLL_FOLDER_FOR_SEARCH "")
+      if (3RDPARTY_TCL_DLL_DIR)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
+      elseif (3RDPARTY_TCL_DIR)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
+      elseif (3RDPARTY_TCL_LIBRARY_DIR)
+        get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
+      endif()
+
+      set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
+      find_library (3RDPARTY_TCL_DLL NAMES tcl86 tcl85
+                                            PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                            NO_DEFAULT_PATH)
     endif()
-
-    set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
-    find_library (3RDPARTY_TCL_DLL NAMES tcl86 tcl85
-                                          PATHS "${DLL_FOLDER_FOR_SEARCH}"
-                                          NO_DEFAULT_PATH)
   endif()
 endif()
 
 COMPLIANCE_PRODUCT_CONSISTENCY(TCL)
 
-# tcl dir and library
-if (NOT 3RDPARTY_TCL_LIBRARY)
-  set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE)
-  find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
-                                            PATHS "${3RDPARTY_TCL_LIBRARY_DIR}"
-                                            NO_DEFAULT_PATH)
+if (BUILD_SHARED_LIBS)
+  # tcl dir and library
+  if (NOT 3RDPARTY_TCL_LIBRARY)
+    set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE)
+    find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
+                                              PATHS "${3RDPARTY_TCL_LIBRARY_DIR}"
+                                              NO_DEFAULT_PATH)
 
-  # search in another place if previous search doesn't find anything
-  find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
-                                            PATHS "${3RDPARTY_TCL_DIR}/lib"
-                                            NO_DEFAULT_PATH)
+    # search in another place if previous search doesn't find anything
+    find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
+                                              PATHS "${3RDPARTY_TCL_DIR}/lib"
+                                              NO_DEFAULT_PATH)
 
 
-  if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
-    set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "TCL library" FORCE)
-  endif()
+    if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
+      set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "TCL library" FORCE)
+    endif()
 
-  if (NOT 3RDPARTY_TCL_LIBRARY_DIR AND 3RDPARTY_TCL_LIBRARY)
-    get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
-    set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
+    if (NOT 3RDPARTY_TCL_LIBRARY_DIR AND 3RDPARTY_TCL_LIBRARY)
+      get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
+      set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
+    endif()
   endif()
-endif()
 
-set (3RDPARTY_TCL_LIBRARY_VERSION "")
-if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
-  get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
-  string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
+  set (3RDPARTY_TCL_LIBRARY_VERSION "")
+  if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
+    get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
+    string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
 
-  if (NOT "${TCL_LIBRARY_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
-    set (3RDPARTY_TCL_LIBRARY_VERSION "${TCL_LIBRARY_VERSION}")
-  else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
-    message (STATUS "Info: TCL version isn't found")
+    if (NOT "${TCL_LIBRARY_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
+      set (3RDPARTY_TCL_LIBRARY_VERSION "${TCL_LIBRARY_VERSION}")
+    else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
+      message (STATUS "Info: TCL version isn't found")
+    endif()
   endif()
-endif()
 
-set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
-if (3RDPARTY_TCL_LIBRARY_VERSION)
-  string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
-  string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
-  set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
-endif()
+  set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
+  if (3RDPARTY_TCL_LIBRARY_VERSION)
+    string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
+    string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
+    set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
+  endif()
 
-if (WIN32)
-  if (NOT 3RDPARTY_TCL_DLL)
-    set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
+  if (WIN32)
+    if (NOT 3RDPARTY_TCL_DLL)
+      set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
+
+      set (DLL_FOLDER_FOR_SEARCH "")
+      if (3RDPARTY_TCL_DLL_DIR)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
+      elseif (3RDPARTY_TCL_DIR)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
+      else()
+        get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
+      endif()
+
+      set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
+      find_library (3RDPARTY_TCL_DLL NAMES tcl${3RDPARTY_TCL_LIBRARY_VERSION}
+                                            PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                            NO_DEFAULT_PATH)
 
-    set (DLL_FOLDER_FOR_SEARCH "")
-    if (3RDPARTY_TCL_DLL_DIR)
-      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
-    elseif (3RDPARTY_TCL_DIR)
-      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
-    else()
-      get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
-      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
+      if (NOT 3RDPARTY_TCL_DLL OR NOT EXISTS "${3RDPARTY_TCL_DLL}")
+        set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "TCL shared library" FORCE)
+      endif()
     endif()
-
-    set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
-    find_library (3RDPARTY_TCL_DLL NAMES tcl${3RDPARTY_TCL_LIBRARY_VERSION}
-                                          PATHS "${DLL_FOLDER_FOR_SEARCH}"
-                                          NO_DEFAULT_PATH)
-
-    if (NOT 3RDPARTY_TCL_DLL OR NOT EXISTS "${3RDPARTY_TCL_DLL}")
-      set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "TCL shared library" FORCE)
+    if (NOT 3RDPARTY_TCL_DLL_DIR AND 3RDPARTY_TCL_DLL)
+      get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
+      set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE)
     endif()
   endif()
-  if (NOT 3RDPARTY_TCL_DLL_DIR AND 3RDPARTY_TCL_DLL)
-    get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
-    set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE)
-  endif()
-endif()
-
-# include found paths to common variables
-if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}")
-  list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}")
-else()
-  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
-endif()
-
-if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
-  list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
-else()
-  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY_DIR})
-endif()
 
-if (WIN32)
-  if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
-    list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
+  # include found paths to common variables
+  if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}")
+    list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}")
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL_DIR)
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
   endif()
-endif()
 
-# install tcl
-if (INSTALL_TCL)
-  # include occt macros. compiler_bitness, os_wiht_bit, compiler
-  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
-
-  OCCT_MAKE_OS_WITH_BITNESS()
-  OCCT_MAKE_COMPILER_SHORT_NAME()
+  if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
+    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
+  else()
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY_DIR})
+  endif()
 
   if (WIN32)
-    # tcl 8.6 requires zlib. install all dlls from tcl bin folder that may contain zlib also
-
-    # collect and install all dlls from tcl dll dirs
-    file (GLOB TCL_DLLS "${3RDPARTY_TCL_DLL_DIR}/*.dll")
+    if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
+      list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
+    else()
+      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL_DIR)
+    endif()
+  endif()
 
-    if (SINGLE_GENERATOR)
-      install (FILES ${TCL_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
+  # install tcl
+  if (INSTALL_TCL)
+    # include occt macros. compiler_bitness, os_wiht_bit, compiler
+    OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
+
+    OCCT_MAKE_OS_WITH_BITNESS()
+    OCCT_MAKE_COMPILER_SHORT_NAME()
+
+    if (WIN32)
+      # tcl 8.6 requires zlib. install all dlls from tcl bin folder that may contain zlib also
+
+      # collect and install all dlls from tcl dll dirs
+      file (GLOB TCL_DLLS "${3RDPARTY_TCL_DLL_DIR}/*.dll")
+
+      if (SINGLE_GENERATOR)
+        install (FILES ${TCL_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
+      else()
+        install (FILES ${TCL_DLLS}
+                 CONFIGURATIONS Release
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
+        install (FILES ${TCL_DLLS}
+                 CONFIGURATIONS RelWithDebInfo
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
+        install (FILES ${TCL_DLLS}
+                 CONFIGURATIONS Debug
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
+      endif()
     else()
-      install (FILES ${TCL_DLLS}
-               CONFIGURATIONS Release
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
-      install (FILES ${TCL_DLLS}
-               CONFIGURATIONS RelWithDebInfo
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
-      install (FILES ${TCL_DLLS}
-               CONFIGURATIONS Debug
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
+      get_filename_component(3RDPARTY_TCL_LIBRARY_REALPATH ${3RDPARTY_TCL_LIBRARY} REALPATH)
+
+      if (SINGLE_GENERATOR)
+        install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
+      else()
+        install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
+                 CONFIGURATIONS Release
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
+        install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
+                 CONFIGURATIONS RelWithDebInfo
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i")
+        install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
+                 CONFIGURATIONS Debug
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
+      endif()
     endif()
-  else()
-    get_filename_component(3RDPARTY_TCL_LIBRARY_REALPATH ${3RDPARTY_TCL_LIBRARY} REALPATH)
 
-    if (SINGLE_GENERATOR)
-      install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
+    if (TCL_TCLSH_VERSION)
+      # tcl is required to install in lib folder (without)
+      install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8"                    DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
+      install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
     else()
-      install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
-               CONFIGURATIONS Release
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
-      install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
-               CONFIGURATIONS RelWithDebInfo
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i")
-      install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
-               CONFIGURATIONS Debug
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
+      message (STATUS "\nWarning: tclX.X subdir won't be copyied during the installation process.")
+      message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
     endif()
-  endif()
 
-  if (TCL_TCLSH_VERSION)
-    # tcl is required to install in lib folder (without)
-    install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8"                    DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
-    install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
+    set (USED_3RDPARTY_TCL_DIR "")
   else()
-    message (STATUS "\nWarning: tclX.X subdir won't be copyied during the installation process.")
-    message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
+    # the library directory for using by the executable
+    if (WIN32)
+      set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
+    else()
+      set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
+    endif()
   endif()
 
-  set (USED_3RDPARTY_TCL_DIR "")
-else()
-  # the library directory for using by the executable
-  if (WIN32)
-    set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
-  else()
-    set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
-  endif()
+  mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL)
 endif()
 
-mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL)
-
 if (TK_FOUND AND 3RDPARTY_TCL_DIR)
 
   get_filename_component (TK_WISH_ABSOLUTE          "${TK_WISH}"          ABSOLUTE)
@@ -278,3 +284,11 @@ OCCT_CHECK_AND_UNSET (TCL_TCLSH)
 OCCT_CHECK_AND_UNSET (TK_LIBRARY)
 OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
 OCCT_CHECK_AND_UNSET (TK_WISH)
+
+if (NOT BUILD_SHARED_LIBS)
+  OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY)
+  OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY_DIR)
+  OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL)
+  OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL_DIR)
+  OCCT_CHECK_AND_UNSET (INSTALL_TCL)
+endif()
\ No newline at end of file
index 04b12b9..a1e1d94 100644 (file)
@@ -1,6 +1,6 @@
 # tk
 
-if (NOT DEFINED INSTALL_TK)
+if (NOT DEFINED INSTALL_TK AND BUILD_SHARED_LIBS)
   set (INSTALL_TK OFF CACHE BOOL "${INSTALL_TK_DESCR}")
 endif()
 
@@ -18,26 +18,28 @@ if (NOT DEFINED 3RDPARTY_TK_INCLUDE_DIR)
   set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk")
 endif()
 
-# tk library file (with absolute path)
-if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR)
-  set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE)
-endif()
+if (BUILD_SHARED_LIBS)
+  # tk library file (with absolute path)
+  if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR)
+    set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE)
+  endif()
 
-# tk library directory
-if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR)
-  set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library")
-endif()
+  # tk library directory
+  if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR)
+    set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library")
+  endif()
 
-# tk shared library (with absolute path)
-if (WIN32)
-  if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR)
-    set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE)
+  # tk shared library (with absolute path)
+  if (WIN32)
+    if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR)
+      set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE)
+    endif()
   endif()
-endif()
 
-# tk shared library directory
-if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR)
-  set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library")
+  # tk shared library directory
+  if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR)
+    set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library")
+  endif()
 endif()
 
 # search for tk in user defined directory
@@ -66,110 +68,114 @@ if (NOT 3RDPARTY_TK_INCLUDE_DIR)
   endif()
 endif()
 
-# tk dir and library
-if (NOT 3RDPARTY_TK_LIBRARY)
-  if (TK_LIBRARY AND EXISTS "${TK_LIBRARY}")
-    set (3RDPARTY_TK_LIBRARY "${TK_LIBRARY}" CACHE FILEPATH "TK library" FORCE)
+if (BUILD_SHARED_LIBS)
+  # tk dir and library
+  if (NOT 3RDPARTY_TK_LIBRARY)
+    if (TK_LIBRARY AND EXISTS "${TK_LIBRARY}")
+      set (3RDPARTY_TK_LIBRARY "${TK_LIBRARY}" CACHE FILEPATH "TK library" FORCE)
 
-    if (NOT 3RDPARTY_TK_LIBRARY_DIR)
-      get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
-      set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
+      if (NOT 3RDPARTY_TK_LIBRARY_DIR)
+        get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
+        set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
+      endif()
     endif()
   endif()
-endif()
-
-
-if (WIN32)
-  if (NOT 3RDPARTY_TK_DLL)
-      set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
 
-      set (DLL_FOLDER_FOR_SEARCH "")
-      if (3RDPARTY_TK_DLL_DIR)
-        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
-      elseif (3RDPARTY_TK_DIR)
-        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
-      elseif (3RDPARTY_TK_LIBRARY_DIR)
-        get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
-        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
-      endif()
 
-      set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
-      find_library (3RDPARTY_TK_DLL NAMES tk86 tk85
-                                            PATHS "${DLL_FOLDER_FOR_SEARCH}"
-                                            NO_DEFAULT_PATH)
+  if (WIN32)
+    if (NOT 3RDPARTY_TK_DLL)
+        set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+
+        set (DLL_FOLDER_FOR_SEARCH "")
+        if (3RDPARTY_TK_DLL_DIR)
+          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
+        elseif (3RDPARTY_TK_DIR)
+          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
+        elseif (3RDPARTY_TK_LIBRARY_DIR)
+          get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
+          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
+        endif()
+
+        set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
+        find_library (3RDPARTY_TK_DLL NAMES tk86 tk85
+                                              PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                              NO_DEFAULT_PATH)
+    endif()
   endif()
 endif()
 
 COMPLIANCE_PRODUCT_CONSISTENCY(TK)
 
-# tk dir and library
-if (NOT 3RDPARTY_TK_LIBRARY)
-  set (3RDPARTY_TK_LIBRARY "3RDPARTY_TK_LIBRARY-NOTFOUND" CACHE FILEPATH "TK library" FORCE)
-  find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
-                                            PATHS "${3RDPARTY_TK_LIBRARY_DIR}"
-                                            NO_DEFAULT_PATH)
+if (BUILD_SHARED_LIBS)
+  # tk dir and library
+  if (NOT 3RDPARTY_TK_LIBRARY)
+    set (3RDPARTY_TK_LIBRARY "3RDPARTY_TK_LIBRARY-NOTFOUND" CACHE FILEPATH "TK library" FORCE)
+    find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
+                                              PATHS "${3RDPARTY_TK_LIBRARY_DIR}"
+                                              NO_DEFAULT_PATH)
 
-  # search in another place if previous search doesn't find anything
-  find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
-                                            PATHS "${3RDPARTY_TK_DIR}/lib"
-                                            NO_DEFAULT_PATH)
+    # search in another place if previous search doesn't find anything
+    find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
+                                              PATHS "${3RDPARTY_TK_DIR}/lib"
+                                              NO_DEFAULT_PATH)
 
 
-  if (NOT 3RDPARTY_TK_LIBRARY OR NOT EXISTS "${3RDPARTY_TK_LIBRARY}")
-    set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "TK library" FORCE)
-  endif()
+    if (NOT 3RDPARTY_TK_LIBRARY OR NOT EXISTS "${3RDPARTY_TK_LIBRARY}")
+      set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "TK library" FORCE)
+    endif()
 
-  if (NOT 3RDPARTY_TK_LIBRARY_DIR AND 3RDPARTY_TK_LIBRARY)
-    get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
-    set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
+    if (NOT 3RDPARTY_TK_LIBRARY_DIR AND 3RDPARTY_TK_LIBRARY)
+      get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
+      set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
+    endif()
   endif()
-endif()
 
-set (3RDPARTY_TK_LIBRARY_VERSION "")
-if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
-  get_filename_component (TK_LIBRARY_NAME "${3RDPARTY_TK_LIBRARY}" NAME)
-  string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY_NAME}")
+  set (3RDPARTY_TK_LIBRARY_VERSION "")
+  if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
+    get_filename_component (TK_LIBRARY_NAME "${3RDPARTY_TK_LIBRARY}" NAME)
+    string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY_NAME}")
 
-  if (NOT "${TK_LIBRARY_VERSION}" STREQUAL "${TK_LIBRARY_NAME}")
-    set (3RDPARTY_TK_LIBRARY_VERSION "${TK_LIBRARY_VERSION}")
-  else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
-    message (STATUS "Info: TK version isn't found")
+    if (NOT "${TK_LIBRARY_VERSION}" STREQUAL "${TK_LIBRARY_NAME}")
+      set (3RDPARTY_TK_LIBRARY_VERSION "${TK_LIBRARY_VERSION}")
+    else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
+      message (STATUS "Info: TK version isn't found")
+    endif()
   endif()
-endif()
 
-set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "")
-if (3RDPARTY_TK_LIBRARY_VERSION)
-  string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TK_MAJOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
-  string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TK_MINOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
-  set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TK_MAJOR_VERSION}.${3RDPARTY_TK_MINOR_VERSION}")
-endif()
+  set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "")
+  if (3RDPARTY_TK_LIBRARY_VERSION)
+    string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TK_MAJOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
+    string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TK_MINOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
+    set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TK_MAJOR_VERSION}.${3RDPARTY_TK_MINOR_VERSION}")
+  endif()
 
-if (WIN32)
-  if (NOT 3RDPARTY_TK_DLL)
-    set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+  if (WIN32)
+    if (NOT 3RDPARTY_TK_DLL)
+      set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
 
-    set (DLL_FOLDER_FOR_SEARCH "")
-    if (3RDPARTY_TK_DLL_DIR)
-      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
-    elseif (3RDPARTY_TK_DIR)
-      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
-    else()
-      get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
-      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
-    endif()
+      set (DLL_FOLDER_FOR_SEARCH "")
+      if (3RDPARTY_TK_DLL_DIR)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
+      elseif (3RDPARTY_TK_DIR)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
+      else()
+        get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
+      endif()
 
-    set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
-    find_library (3RDPARTY_TK_DLL NAMES tk${3RDPARTY_TK_LIBRARY_VERSION}
-                                          PATHS "${DLL_FOLDER_FOR_SEARCH}"
-                                          NO_DEFAULT_PATH)
+      set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
+      find_library (3RDPARTY_TK_DLL NAMES tk${3RDPARTY_TK_LIBRARY_VERSION}
+                                            PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                            NO_DEFAULT_PATH)
 
-    if (NOT 3RDPARTY_TK_DLL OR NOT EXISTS "${3RDPARTY_TK_DLL}")
-      set (3RDPARTY_TK_DLL "" CACHE FILEPATH "TK shared library" FORCE)
+      if (NOT 3RDPARTY_TK_DLL OR NOT EXISTS "${3RDPARTY_TK_DLL}")
+        set (3RDPARTY_TK_DLL "" CACHE FILEPATH "TK shared library" FORCE)
+      endif()
+    endif()
+    if (NOT 3RDPARTY_TK_DLL_DIR AND 3RDPARTY_TK_DLL)
+      get_filename_component (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL}" PATH)
+      set (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL_DIR}" CACHE FILEPATH "The directory containing TK shared library" FORCE)
     endif()
-  endif()
-  if (NOT 3RDPARTY_TK_DLL_DIR AND 3RDPARTY_TK_DLL)
-    get_filename_component (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL}" PATH)
-    set (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL_DIR}" CACHE FILEPATH "The directory containing TK shared library" FORCE)
   endif()
 endif()
 
@@ -180,85 +186,87 @@ else()
   list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_INCLUDE_DIR)
 endif()
 
-if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
-  list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TK_LIBRARY_DIR}")
-else()
-  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_LIBRARY_DIR})
-endif()
-
-if (WIN32)
-  if (3RDPARTY_TK_DLL OR EXISTS "${3RDPARTY_TK_DLL}")
-    list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TK_DLL_DIR}")
+if (BUILD_SHARED_LIBS)
+  if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
+    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TK_LIBRARY_DIR}")
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_DLL_DIR)
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_LIBRARY_DIR})
   endif()
-endif()
-
-# install tk
-if (INSTALL_TK)
-  # include occt macros. compiler_bitness, os_wiht_bit, compiler
-  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
-
-  OCCT_MAKE_OS_WITH_BITNESS()
-  OCCT_MAKE_COMPILER_SHORT_NAME()
 
   if (WIN32)
-    # tk 8.6 requires zlib. install all dlls from tk bin folder that may contain zlib also
-
-    # collect and install all dlls from tk dll dirs
-    file (GLOB TK_DLLS  "${3RDPARTY_TK_DLL_DIR}/*.dll")
+    if (3RDPARTY_TK_DLL OR EXISTS "${3RDPARTY_TK_DLL}")
+      list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TK_DLL_DIR}")
+    else()
+      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_DLL_DIR)
+    endif()
+  endif()
 
-    if (SINGLE_GENERATOR)
-      install (FILES ${TK_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
+  # install tk
+  if (INSTALL_TK)
+    # include occt macros. compiler_bitness, os_wiht_bit, compiler
+    OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
+
+    OCCT_MAKE_OS_WITH_BITNESS()
+    OCCT_MAKE_COMPILER_SHORT_NAME()
+
+    if (WIN32)
+      # tk 8.6 requires zlib. install all dlls from tk bin folder that may contain zlib also
+
+      # collect and install all dlls from tk dll dirs
+      file (GLOB TK_DLLS  "${3RDPARTY_TK_DLL_DIR}/*.dll")
+
+      if (SINGLE_GENERATOR)
+        install (FILES ${TK_DLLS} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
+      else()
+        install (FILES ${TK_DLLS}
+                 CONFIGURATIONS Release
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
+        install (FILES ${TK_DLLS}
+                 CONFIGURATIONS RelWithDebInfo
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
+        install (FILES ${TK_DLLS}
+                 CONFIGURATIONS Debug
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
+      endif()
     else()
-      install (FILES ${TK_DLLS}
-               CONFIGURATIONS Release
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
-      install (FILES ${TK_DLLS}
-               CONFIGURATIONS RelWithDebInfo
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
-      install (FILES ${TK_DLLS}
-               CONFIGURATIONS Debug
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
+      get_filename_component(3RDPARTY_TK_LIBRARY_REALPATH ${3RDPARTY_TK_LIBRARY} REALPATH)
+
+      if (SINGLE_GENERATOR)
+        install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
+      else()
+        install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
+                 CONFIGURATIONS Release
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/")
+        install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
+                 CONFIGURATIONS RelWithDebInfo
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/i")
+        install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
+                 CONFIGURATIONS Debug
+                 DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
+      endif()
     endif()
-  else()
-    get_filename_component(3RDPARTY_TK_LIBRARY_REALPATH ${3RDPARTY_TK_LIBRARY} REALPATH)
 
-    if (SINGLE_GENERATOR)
-      install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
+    if (TCL_TCLSH_VERSION)
+      # tk is required to install in lib folder (without)
+      install (DIRECTORY "${3RDPARTY_TK_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}"  DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
     else()
-      install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
-               CONFIGURATIONS Release
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/")
-      install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
-               CONFIGURATIONS RelWithDebInfo
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}/i")
-      install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
-               CONFIGURATIONS Debug
-               DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d")
+      message (STATUS "\nWarning: tkX.X subdir won't be copyied during the installation process.")
+      message (STATUS "Try seeking tk within another folder by changing 3RDPARTY_TK_DIR variable.")
     endif()
-  endif()
 
-  if (TCL_TCLSH_VERSION)
-    # tk is required to install in lib folder (without)
-    install (DIRECTORY "${3RDPARTY_TK_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}"  DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
+    set (USED_3RDPARTY_TK_DIR "")
   else()
-    message (STATUS "\nWarning: tkX.X subdir won't be copyied during the installation process.")
-    message (STATUS "Try seeking tk within another folder by changing 3RDPARTY_TK_DIR variable.")
+    # the library directory for using by the executable
+    if (WIN32)
+      set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_DLL_DIR})
+    else()
+      set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_LIBRARY_DIR})
+    endif()
   endif()
 
-  set (USED_3RDPARTY_TK_DIR "")
-else()
-  # the library directory for using by the executable
-  if (WIN32)
-    set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_DLL_DIR})
-  else()
-    set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_LIBRARY_DIR})
-  endif()
+  mark_as_advanced (3RDPARTY_TK_LIBRARY 3RDPARTY_TK_DLL)
 endif()
 
-mark_as_advanced (3RDPARTY_TK_LIBRARY 3RDPARTY_TK_DLL)
-
 # unset all redundant variables
 #TCL
 OCCT_CHECK_AND_UNSET (TCL_LIBRARY)
@@ -268,3 +276,11 @@ OCCT_CHECK_AND_UNSET (TCL_TCLSH)
 OCCT_CHECK_AND_UNSET (TK_LIBRARY)
 OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
 OCCT_CHECK_AND_UNSET (TK_WISH)
+
+if (NOT BUILD_SHARED_LIBS)
+  OCCT_CHECK_AND_UNSET (3RDPARTY_TK_LIBRARY)
+  OCCT_CHECK_AND_UNSET (3RDPARTY_TK_LIBRARY_DIR)
+  OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL)
+  OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL_DIR)
+  OCCT_CHECK_AND_UNSET (INSTALL_TK)
+endif()
\ No newline at end of file
index d4cb9e1..cd4103e 100644 (file)
@@ -31,23 +31,27 @@ if (NOT DEFINED 3RDPARTY_VTK_INCLUDE_DIR)
   set (3RDPARTY_VTK_INCLUDE_DIR "" CACHE PATH "The directory containing headers of VTK")
 endif()
 
-# vtk library directory
-if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
-  set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE PATH "The directory containing VTK libraries")
-endif()
+if (BUILD_SHARED_LIBS)
+  # vtk library directory
+  if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
+    set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE PATH "The directory containing VTK libraries")
+  endif()
 
-# vtk dll directory
-if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
-  set (3RDPARTY_VTK_DLL_DIR "" CACHE PATH "The directory containing VTK shared libraries")
+  # vtk dll directory
+  if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
+    set (3RDPARTY_VTK_DLL_DIR "" CACHE PATH "The directory containing VTK shared libraries")
+  endif()
 endif()
 
 # check 3RDPARTY_VTK_ paths for consistency with specified 3RDPARTY_VTK_DIR
 if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}")
   CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_INCLUDE_DIR PATH "The directory containing headers of VTK")
-  CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_LIBRARY_DIR PATH "The directory containing VTK libraries")
+  if (BUILD_SHARED_LIBS)
+    CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_LIBRARY_DIR PATH "The directory containing VTK libraries")
 
-  if (WIN32)
-    CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_DLL_DIR PATH "The directory containing VTK shared library")
+    if (WIN32)
+      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_DLL_DIR PATH "The directory containing VTK shared library")
+    endif()
   endif()
 endif()
 
@@ -70,8 +74,11 @@ if (VTK_FOUND)
   if (VTK_LIBRARIES)
 
     set (3RDPARTY_VTK_INCLUDE_DIRS)
-    set (3RDPARTY_VTK_LIBRARY_DIRS)
-    set (3RDPARTY_VTK_DLL_DIRS)
+
+    if (BUILD_SHARED_LIBS)
+      set (3RDPARTY_VTK_LIBRARY_DIRS)
+      set (3RDPARTY_VTK_DLL_DIRS)
+    endif()
 
     foreach (VTK_LIBRARY ${VTK_LIBRARIES})
       string (REGEX MATCH "^vtk" IS_VTK_LIBRARY ${VTK_LIBRARY})
@@ -81,70 +88,71 @@ if (VTK_FOUND)
           list (APPEND 3RDPARTY_VTK_INCLUDE_DIRS "${${VTK_LIBRARY}_INCLUDE_DIRS}")
         endif()
 
-        if (${VTK_LIBRARY}_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
-          list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
-        endif()
-
-        if (${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
-          list (APPEND 3RDPARTY_VTK_DLL_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
-          if (NOT WIN32)
-            list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
+          if (${VTK_LIBRARY}_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
+            list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_LIBRARY_DIRS}")
           endif()
-        endif()
 
-        # get paths from corresponding properties
-        get_target_property (TARGET_VTK_IMPORT_CONFS ${VTK_LIBRARY} IMPORTED_CONFIGURATIONS)
-
-        if (TARGET_VTK_IMPORT_CONFS)
-          list (GET TARGET_VTK_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
-          
-          # todo: choose configuration in connection with the build type
-          #if (CMAKE_BUILD_TYPE)
-          #  foreach (IMPORT_CONF ${TARGET_VTK_IMPORT_CONFS})
-          #  endforeach()
-          #endif()
-
-          # Work-around against link failure in case if VTK contains dependency
-          # on DirectX: its run-time is always present on Windows, but SDK can
-          # be absent on current workstation, while not actually needed for 
-          # OCCT linking.
-          # VTK 6.1 for VC 10
-          get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF})
-          if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
-            string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
-            if (HARDCODED_D3D9_LIB)
-              message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
-              
-              list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
-              set_target_properties (${VTK_LIBRARY} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF} "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
-            endif()            
-          endif()
-          # VTK 6.1 for VC 12, 14
-          get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} INTERFACE_LINK_LIBRARIES)
-          if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
-            string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
-            if (HARDCODED_D3D9_LIB)
-              message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
-              
-              list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
-              set_target_properties (${VTK_LIBRARY} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
-            endif()            
+          if (${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS AND EXISTS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
+            list (APPEND 3RDPARTY_VTK_DLL_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
+            if (NOT WIN32)
+              list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${${VTK_LIBRARY}_RUNTIME_LIBRARY_DIRS}")
+            endif()
           endif()
 
-          get_target_property (TARGET_PROPERTY_IMP_PATH ${VTK_LIBRARY} IMPORTED_IMPLIB_${CHOSEN_IMPORT_CONF})
-          if(TARGET_PROPERTY_IMP_PATH AND EXISTS "${TARGET_PROPERTY_IMP_PATH}")
-            get_filename_component (TARGET_PROPERTY_IMP_DIR "${TARGET_PROPERTY_IMP_PATH}" PATH)
-            list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_IMP_DIR}")
-          endif()
+          # get paths from corresponding properties
+          get_target_property (TARGET_VTK_IMPORT_CONFS ${VTK_LIBRARY} IMPORTED_CONFIGURATIONS)
+
+          if (TARGET_VTK_IMPORT_CONFS)
+            list (GET TARGET_VTK_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
+
+            # todo: choose configuration in connection with the build type
+            #if (CMAKE_BUILD_TYPE)
+            #  foreach (IMPORT_CONF ${TARGET_VTK_IMPORT_CONFS})
+            #  endforeach()
+            #endif()
+
+            # Work-around against link failure in case if VTK contains dependency
+            # on DirectX: its run-time is always present on Windows, but SDK can
+            # be absent on current workstation, while not actually needed for 
+            # OCCT linking.
+            # VTK 6.1 for VC 10
+            get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF})
+            if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
+              string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
+              if (HARDCODED_D3D9_LIB)
+                message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
+
+                list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
+                set_target_properties (${VTK_LIBRARY} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_${CHOSEN_IMPORT_CONF} "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
+              endif()
+            endif()
+            # VTK 6.1 for VC 12, 14
+            get_target_property (TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${VTK_LIBRARY} INTERFACE_LINK_LIBRARIES)
+            if(TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES)
+              string (REGEX MATCH "[^;]*d3d[0-9]+[.]lib" HARDCODED_D3D9_LIB "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
+              if (HARDCODED_D3D9_LIB)
+                message (STATUS "Warning: ${HARDCODED_D3D9_LIB} has been removed from imported dependencies of ${VTK_LIBRARY}")
+
+                list (REMOVE_ITEM TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES ${HARDCODED_D3D9_LIB})
+                set_target_properties (${VTK_LIBRARY} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET_PROPERTY_IMP_LINK_INTERFACE_LIBRARIES}")
+              endif()
+            endif()
 
-          get_target_property (TARGET_PROPERTY_LOCATION_PATH ${VTK_LIBRARY} IMPORTED_LOCATION_${CHOSEN_IMPORT_CONF})
-          if(TARGET_PROPERTY_LOCATION_PATH AND EXISTS "${TARGET_PROPERTY_LOCATION_PATH}")
-            get_filename_component (TARGET_PROPERTY_LOCATION_DIR "${TARGET_PROPERTY_LOCATION_PATH}" PATH)
+            get_target_property (TARGET_PROPERTY_IMP_PATH ${VTK_LIBRARY} IMPORTED_IMPLIB_${CHOSEN_IMPORT_CONF})
+            if(TARGET_PROPERTY_IMP_PATH AND EXISTS "${TARGET_PROPERTY_IMP_PATH}")
+              get_filename_component (TARGET_PROPERTY_IMP_DIR "${TARGET_PROPERTY_IMP_PATH}" PATH)
+              list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_IMP_DIR}")
+            endif()
+
+            get_target_property (TARGET_PROPERTY_LOCATION_PATH ${VTK_LIBRARY} IMPORTED_LOCATION_${CHOSEN_IMPORT_CONF})
+            if(TARGET_PROPERTY_LOCATION_PATH AND EXISTS "${TARGET_PROPERTY_LOCATION_PATH}")
+              get_filename_component (TARGET_PROPERTY_LOCATION_DIR "${TARGET_PROPERTY_LOCATION_PATH}" PATH)
 
-            if (WIN32)
-              list (APPEND 3RDPARTY_VTK_DLL_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
-            else()
-              list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
+              if (WIN32)
+                list (APPEND 3RDPARTY_VTK_DLL_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
+              else()
+                list (APPEND 3RDPARTY_VTK_LIBRARY_DIRS "${TARGET_PROPERTY_LOCATION_DIR}")
+              endif()
             endif()
           endif()
         endif()
@@ -160,24 +168,25 @@ if (VTK_FOUND)
     set (3RDPARTY_VTK_INCLUDE_DIR "${3RDPARTY_VTK_INCLUDE_DIR}" CACHE PATH "The directory containing headers of VTK" FORCE)
   endif()
 
-  if (3RDPARTY_VTK_LIBRARY_DIRS)
-    list (REMOVE_DUPLICATES 3RDPARTY_VTK_LIBRARY_DIRS)
-    list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIRS})
+  if (BUILD_SHARED_LIBS)
+    if (3RDPARTY_VTK_LIBRARY_DIRS)
+      list (REMOVE_DUPLICATES 3RDPARTY_VTK_LIBRARY_DIRS)
+      list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIRS})
 
-    list (GET 3RDPARTY_VTK_LIBRARY_DIRS 0 3RDPARTY_VTK_LIBRARY_DIR)
-    set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_LIBRARY_DIR}" CACHE PATH "The directory containing VTK libraries" FORCE)
-  endif()
+      list (GET 3RDPARTY_VTK_LIBRARY_DIRS 0 3RDPARTY_VTK_LIBRARY_DIR)
+      set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_LIBRARY_DIR}" CACHE PATH "The directory containing VTK libraries" FORCE)
+    endif()
 
-  if (WIN32)
-    if (3RDPARTY_VTK_DLL_DIRS)
-      list (REMOVE_DUPLICATES 3RDPARTY_VTK_DLL_DIRS)
-      list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIRS})
+    if (WIN32)
+      if (3RDPARTY_VTK_DLL_DIRS)
+        list (REMOVE_DUPLICATES 3RDPARTY_VTK_DLL_DIRS)
+        list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIRS})
 
-      list (GET 3RDPARTY_VTK_DLL_DIRS 0 3RDPARTY_VTK_DLL_DIR)
-      set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DLL_DIR}" CACHE PATH "The directory containing VTK shared libraries" FORCE)
+        list (GET 3RDPARTY_VTK_DLL_DIRS 0 3RDPARTY_VTK_DLL_DIR)
+        set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DLL_DIR}" CACHE PATH "The directory containing VTK shared libraries" FORCE)
+      endif()
     endif()
   endif()
-endif()
 
 if (3RDPARTY_VTK_INCLUDE_DIR AND EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
   list (APPEND 3RDPARTY_INCLUDE_DIRS ${3RDPARTY_VTK_INCLUDE_DIR})
@@ -185,17 +194,19 @@ else()
   list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_INCLUDE_DIR)
 endif()
 
-if (3RDPARTY_VTK_LIBRARY_DIR AND EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
-  list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIR})
-else()
-  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_LIBRARY_DIR)
-endif()
-
-if (WIN32)
-  if (3RDPARTY_VTK_DLL_DIR OR EXISTS "${3RDPARTY_VTK_DLL_DIR}")
-    list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIR})
+if (BUILD_SHARED_LIBS)
+  if (3RDPARTY_VTK_LIBRARY_DIR AND EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
+    list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIR})
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_DLL_DIR)
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_LIBRARY_DIR)
+  endif()
+
+  if (WIN32)
+    if (3RDPARTY_VTK_DLL_DIR OR EXISTS "${3RDPARTY_VTK_DLL_DIR}")
+      list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIR})
+    else()
+      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_DLL_DIR)
+    endif()
   endif()
 endif()