0028335: Configuration, Cmake - 3rdparty library names present in two places and...
authorski <ski@opencascade.com>
Fri, 27 Jan 2017 12:53:06 +0000 (15:53 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 12 Apr 2017 14:53:14 +0000 (17:53 +0300)
Libraries names from file adm/cmake/occt_csf.cmake are used to search libraries.

Removed hardcoded variants of tcl/tk libraries names for searching.

15 files changed:
CMakeLists.txt
adm/cmake/3rdparty_macro.cmake
adm/cmake/egl.cmake
adm/cmake/eigen.cmake
adm/cmake/freeimage.cmake
adm/cmake/freetype.cmake
adm/cmake/gl2ps.cmake
adm/cmake/gles2.cmake
adm/cmake/glx.cmake
adm/cmake/occt_csf.cmake
adm/cmake/occt_macros.cmake
adm/cmake/occt_toolkit.cmake
adm/cmake/tbb.cmake
adm/cmake/tcl.cmake
adm/cmake/tk.cmake

index 37d3864..11177f6 100644 (file)
@@ -447,8 +447,17 @@ else()
   set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH "${3RDPARTY_DIR_DESCR}" FORCE)
 endif()
 
-# search for CSF_TclLibs variable in EXTERNLIB of each being used toolkit
+# search for CSF variable in EXTERNLIB of each being used toolkit
+OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGE)
 OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
+OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE)
+OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_GLES2)
+OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS)
+OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB)
+OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
+
+# define CSF variable
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
 
 if (USE_TCL)
   message (STATUS "Info: TCL is used by OCCT")
@@ -464,9 +473,6 @@ else()
   OCCT_CHECK_AND_UNSET ("INSTALL_TK")
 endif()
 
-# search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit
-OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE)
-
 if (USE_FREETYPE)
   message (STATUS "Info: Freetype is used by OCCT")
   OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype")
@@ -507,8 +513,6 @@ if (USE_GLX)
 endif()
 
 # FREEIMAGE
-# search for CSF_FREEIMAGE variable in EXTERNLIB of each being used toolkit
-OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGE)
 
 if (CAN_USE_FREEIMAGE)
   set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}")
@@ -528,7 +532,6 @@ else()
 endif()
 
 # OpenGL ES 2.0
-OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_GLES2)
 if (WIN32 AND CAN_USE_GLES2)
   if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
     set (USE_GLES2 ON)
@@ -556,9 +559,6 @@ else()
 endif()
 
 # GL2PS
-# search for CSF_GL2PS variable in EXTERNLIB of each being used toolkit
-OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS)
-
 if (NOT DEFINED ANDROID AND CAN_USE_GL2PS)
   set (USE_GL2PS OFF CACHE BOOL "${USE_GL2PS_DESCR}")
 
@@ -577,9 +577,6 @@ else()
 endif()
 
 # TBB
-# search for CSF_TBB variable in EXTERNLIB of each being used toolkit
-OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB)
-
 if (NOT DEFINED ANDROID AND CAN_USE_TBB)
   set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")
 
@@ -600,9 +597,6 @@ else()
 endif()
 
 # EIGEN
-# search for CSF_EIGEN variable in EXTERNLIB of each being used toolkit
-OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
-
 if (CAN_USE_EIGEN)
   set (USE_EIGEN OFF CACHE BOOL "${USE_EIGEN_DESCR}")
 
@@ -840,9 +834,6 @@ if (NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
   OCCT_UPDATE_DRAW_DEFAULT_FILE()
 endif()
 
-# define CSF variable
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
-
 # include patched toolkit projects or original ones
 foreach (BUILD_TOOLKIT ${BUILD_TOOLKITS})
   OCCT_ADD_SUBDIRECTORY ("src/${BUILD_TOOLKIT}")
index a9a8c23..06f343e 100644 (file)
@@ -6,7 +6,7 @@ endif()
 set(3RDPARTY_MACRO_ALREADY_INCLUDED 1)
 
 
-macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEBUG)
+macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME_DEBUG_SUFFIX)
 
   if (NOT DEFINED INSTALL_${PRODUCT_NAME} AND BUILD_SHARED_LIBS)
     set (INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "${INSTALL_${PRODUCT_NAME}_DESCR}")
@@ -37,54 +37,57 @@ 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 (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()
+  separate_arguments (${LIBRARY_CSF_NAME})
+  foreach (LIBRARY_NAME ${${LIBRARY_CSF_NAME}})
+    string (REPLACE "." "" LIBRARY_NAME "${LIBRARY_NAME}")
+    if (BUILD_SHARED_LIBS)
+      if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME} OR NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}}")
+        set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME}               "" CACHE FILEPATH "${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" 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_${LIBRARY_NAME})
+        set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}           "" CACHE PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"")
+      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_${LIBRARY_NAME} OR NOT 3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}")
+          set (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME}                 "" CACHE FILEPATH "${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" 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_${LIBRARY_NAME})
+          set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}             "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"")
+        endif()
       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}")
-    if (BUILD_SHARED_LIBS)
-      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY FILEPATH "the path to ${PRODUCT_NAME} library")
+    # 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}")
+      if (BUILD_SHARED_LIBS)
+        CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME} FILEPATH "the path to ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"")
 
-      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_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME}}")
+          get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME}}" PATH)
+          set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
+        else()
+          CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"")
+        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_${LIBRARY_NAME} FILEPATH "the path to ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"")
 
-        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_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME}}")
+            get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME}}" PATH)
+            set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" FORCE)
+          else()
+            CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} PATH "The directory containing ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"")
+          endif()
         endif()
       endif()
     endif()
-  endif()
-
+  endforeach()
   # header
   if (NOT 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
 
@@ -112,158 +115,161 @@ 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()
 
-  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 .a)
-
-      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}")
+  foreach (LIBRARY_NAME ${${LIBRARY_CSF_NAME}})
+    string (REPLACE "." "" LIBRARY_NAME_SUFFIX "${LIBRARY_NAME}")
+    if (BUILD_SHARED_LIBS)
+      # library
+      if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}}")
+        set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
 
-        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_${LIBRARY_NAME_SUFFIX} "3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" 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_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME}
+                                                                                PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}}" "${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_${LIBRARY_NAME_SUFFIX} 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_${LIBRARY_NAME_SUFFIX} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}}")
+          get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX} "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}}" PATH)
+          set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX} "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}" CACHE PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" 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_${LIBRARY_NAME_SUFFIX} "" CACHE PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" 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_${LIBRARY_NAME_SUFFIX} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}")
+        list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}")
       else()
-        list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
+        list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX})
+
+        set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} "" CACHE FILEPATH "The path to ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
       endif()
-    endif()
 
-    set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "")
+      # shared library
+      if (WIN32)
+        if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}")
 
-    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_BIN}")
-        else()
-          install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
-                   CONFIGURATIONS Release
-                   DESTINATION "${INSTALL_DIR_BIN}")
-          install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
-                   CONFIGURATIONS RelWithDebInfo
-                   DESTINATION "${INSTALL_DIR_BIN}i")
-          install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"
-                   CONFIGURATIONS Debug
-                   DESTINATION "${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_${LIBRARY_NAME_SUFFIX} "3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" 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_${LIBRARY_NAME_SUFFIX}  NAMES ${LIBRARY_NAME}
+                                                                               PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}"
+                                                                               PATH_SUFFIXES bin
+                                                                               NO_DEFAULT_PATH)
+          else()
+            find_library (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME} PATH_SUFFIXES bin)
+          endif()
 
-          if (SINGLE_GENERATOR)
-            install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR_LIB}" RENAME ${FREEIMLIB}.3)
+          if (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}")
+            get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX} "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}" PATH)
+            set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX} "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}}" CACHE PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
           else()
-            install (FILES "${ABS_PATH}"
-                     CONFIGURATIONS Release
-                     DESTINATION "${INSTALL_DIR_LIB}"
-                     RENAME ${FREEIMLIB}.3)
-            install (FILES "${ABS_PATH}"
-                     CONFIGURATIONS RelWithDebInfo
-                     DESTINATION "${INSTALL_DIR_LIB}i"
-                     RENAME ${FREEIMLIB}.3)
-            install (FILES "${ABS_PATH}"
-                     CONFIGURATIONS Debug
-                     DESTINATION "${INSTALL_DIR_LIB}d"
-                     RENAME ${FREEIMLIB}.3)
+            set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX} "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" FORCE)
+
+            set (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} "" CACHE FILEPATH "${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" FORCE)
           endif()
         endif()
 
-        if("${PRODUCT_NAME}" STREQUAL "GL2PS")
-          get_filename_component(GL2PSLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
+        if (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX} OR EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}}")
+          list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}}")
+        else()
+          list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX})
+        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_LIB}" RENAME ${GL2PSLIB}.1)
+            install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}" DESTINATION "${INSTALL_DIR_BIN}")
           else()
-            install (FILES "${ABS_PATH}"
+            install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}"
                      CONFIGURATIONS Release
-                     DESTINATION "${INSTALL_DIR_LIB}"
-                     RENAME ${GL2PSLIB}.1)
-            install (FILES "${ABS_PATH}"
+                     DESTINATION "${INSTALL_DIR_BIN}")
+            install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}"
                      CONFIGURATIONS RelWithDebInfo
-                     DESTINATION "${INSTALL_DIR_LIB}i"
-                     RENAME ${GL2PSLIB}.1)
-            install (FILES "${ABS_PATH}"
+                     DESTINATION "${INSTALL_DIR_BIN}i")
+            install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}"
                      CONFIGURATIONS Debug
-                     DESTINATION "${INSTALL_DIR_LIB}d"
-                     RENAME ${GL2PSLIB}.1)
+                     DESTINATION "${INSTALL_DIR_BIN}d")
+          endif()
+        else()
+          get_filename_component(ABS_PATH ${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}} REALPATH)
+
+          if ("${PRODUCT_NAME}" STREQUAL "FREEIMAGE")
+            get_filename_component(FREEIMLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}} NAME)
+
+            if (SINGLE_GENERATOR)
+              install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR_LIB}" RENAME ${FREEIMLIB}.3)
+            else()
+              install (FILES "${ABS_PATH}"
+                       CONFIGURATIONS Release
+                       DESTINATION "${INSTALL_DIR_LIB}"
+                       RENAME ${FREEIMLIB}.3)
+              install (FILES "${ABS_PATH}"
+                       CONFIGURATIONS RelWithDebInfo
+                       DESTINATION "${INSTALL_DIR_LIB}i"
+                       RENAME ${FREEIMLIB}.3)
+              install (FILES "${ABS_PATH}"
+                       CONFIGURATIONS Debug
+                       DESTINATION "${INSTALL_DIR_LIB}d"
+                       RENAME ${FREEIMLIB}.3)
+            endif()
+          endif()
+
+          if("${PRODUCT_NAME}" STREQUAL "GL2PS")
+            get_filename_component(GL2PSLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}} NAME)
+
+            if (SINGLE_GENERATOR)
+              install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR_LIB}" RENAME ${GL2PSLIB}.1)
+            else()
+              install (FILES "${ABS_PATH}"
+                       CONFIGURATIONS Release
+                       DESTINATION "${INSTALL_DIR_LIB}"
+                       RENAME ${GL2PSLIB}.1)
+              install (FILES "${ABS_PATH}"
+                       CONFIGURATIONS RelWithDebInfo
+                       DESTINATION "${INSTALL_DIR_LIB}i"
+                       RENAME ${GL2PSLIB}.1)
+              install (FILES "${ABS_PATH}"
+                       CONFIGURATIONS Debug
+                       DESTINATION "${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_${LIBRARY_NAME_SUFFIX}}")
+        else()
+          set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}")
+        endif()
       endif()
-    endif()
 
-    mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
-  endif()
+      mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} 3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX})
+    endif()
+  endforeach()
 endmacro()
 
 macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
index fcbcbc7..d6b1c4b 100644 (file)
@@ -1,6 +1,3 @@
 # EGL
-if (WIN32)
-  THIRDPARTY_PRODUCT("EGL" "EGL/egl.h" "libEGL" "libEGL")
-else()
-  THIRDPARTY_PRODUCT("EGL" "EGL/egl.h" "EGL" "EGL")
-endif()
+
+THIRDPARTY_PRODUCT("EGL" "EGL/egl.h" "CSF_OpenGlLibs" "")
index a9c5e15..d0ae133 100644 (file)
@@ -39,7 +39,7 @@ if (NOT 3RDPARTY_EIGEN_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_EIGEN_INCLUDE_DIR}"
 
   # use default (CMake) EIGEN search
   if (NOT 3RDPARTY_EIGEN_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_EIGEN_INCLUDE_DIR}")
-    # use 3RDPARTY_FREETYPE_DIR if it is specified for freetype search
+    # use 3RDPARTY_EIGEN_DIR if it is specified for eigen search
     if (3RDPARTY_EIGEN_DIR AND EXISTS "${3RDPARTY_EIGEN_DIR}")
       set (CACHED_EIGEN_DIR $ENV{Eigen3_DIR})
       set (ENV{Eigen3_DIR} "${3RDPARTY_EIGEN_DIR}")
index b1cbf34..50f32cb 100644 (file)
@@ -1,3 +1,3 @@
 #freeimage
 
-THIRDPARTY_PRODUCT("FREEIMAGE" "FreeImage.h" "freeimage" "freeimaged")
\ No newline at end of file
+THIRDPARTY_PRODUCT("FREEIMAGE" "FreeImage.h" "CSF_FreeImagePlus" "d")
index b348573..8d4ebe7 100644 (file)
@@ -231,13 +231,13 @@ if (BUILD_SHARED_LIBS)
     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
+      find_library (3RDPARTY_FREETYPE_LIBRARY ${CSF_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 
+      find_library (3RDPARTY_FREETYPE_LIBRARY ${CSF_FREETYPE}
                                               PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
                                               CMAKE_FIND_ROOT_PATH_BOTH)
     endif()
@@ -268,12 +268,12 @@ if (BUILD_SHARED_LIBS)
       set (3RDPARTY_FREETYPE_DLL "3RDPARTY_FREETYPE_DLL-NOTFOUND" CACHE FILEPATH "The path to freetype shared library" FORCE)
 
       if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
-        find_library (3RDPARTY_FREETYPE_DLL freetype
+        find_library (3RDPARTY_FREETYPE_DLL ${CSF_FREETYPE}
                                             PATHS "${3RDPARTY_FREETYPE_DIR}"
                                             PATH_SUFFIXES bin
                                             NO_DEFAULT_PATH)
       else()
-        find_library (3RDPARTY_FREETYPE_DLL freetype
+        find_library (3RDPARTY_FREETYPE_DLL ${CSF_FREETYPE}
                                             PATH_SUFFIXES bin)
       endif()
 
index d9d59ec..2fe5385 100644 (file)
@@ -1,3 +1,3 @@
 #GL2PS
 
-THIRDPARTY_PRODUCT("GL2PS" "gl2ps.h" "gl2ps" "gl2psd")
\ No newline at end of file
+THIRDPARTY_PRODUCT("GL2PS" "gl2ps.h" "CSF_GL2PS" "d")
index d834b66..adbb787 100644 (file)
@@ -1,6 +1,3 @@
 # OpenGL ES 2.0
-if (WIN32)
-  THIRDPARTY_PRODUCT("GLES2" "GLES2/gl2.h" "libGLESv2" "libGLESv2")
-else()
-  THIRDPARTY_PRODUCT("GLES2" "GLES2/gl2.h" "GLESv2" "GLESv2")
-endif()
+
+THIRDPARTY_PRODUCT("GLES2" "GLES2/gl2.h" "CSF_OpenGlLibs" "")
index 2965557..b5fa891 100644 (file)
@@ -1,3 +1,4 @@
 # glx
 
-THIRDPARTY_PRODUCT("GLX" "GL/glx.h" "GL" "GLd")
\ No newline at end of file
+separate_arguments (CSF_OpenGlLibs)
+THIRDPARTY_PRODUCT("GLX" "GL/glx.h" "CSF_OpenGlLibs" "d")
index e01957b..e71e928 100644 (file)
@@ -10,60 +10,65 @@ if (NOT DEFINED USE_TCL)
   OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
 endif()
 
-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")
-  endif()
-
-  if ("${3RDPARTY_TK_LIBRARY_VERSION}" STREQUAL "")
-    message (STATUS "Warning: TK version has not been specified by CSF_TclTkLibs defining thus it will be used as 8.6")
-    set (3RDPARTY_TK_LIBRARY_VERSION "8.6")
-  endif()
-endif()
-
+# TBB
 if (USE_TBB)
   set (CSF_TBB "tbb tbbmalloc")
 else()
   set (CSF_TBB)
 endif()
 
-if (WIN32)
-  set (CSF_advapi32      "advapi32.lib")
-  set (CSF_gdi32         "gdi32.lib")
-  set (CSF_user32        "user32.lib")
-  set (CSF_wsock32       "wsock32.lib")
-  set (CSF_psapi         "Psapi.lib")
-  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" OR USE_GLES2)
-    set (CSF_OpenGlLibs  "libEGL.lib libGLESv2.lib")
-  else()
-    set (CSF_OpenGlLibs  "opengl32.lib")
-  endif()
+# FREETYPE
+if (USE_FREETYPE)
+  set (CSF_FREETYPE "freetype")
+else()
+  set (CSF_FREETYPE)
+endif()
 
-  if (USE_FREETYPE)
-    set (CSF_FREETYPE "freetype.lib")
+# FREEIMAGE
+if (USE_FREEIMAGE)
+  set (CSF_FreeImagePlus "freeimage")
+else()
+  set (CSF_FreeImagePlus)
+endif()
+
+# TCL/TK
+if (USE_TCL)
+  if (WIN32)
+    set (CSF_TclLibs     "tcl8.6")
+    set (CSF_TclTkLibs   "tk8.6")
   else()
-    set (CSF_FREETYPE)
+    if(APPLE)
+      set (CSF_TclTkLibs Tk)
+      set (CSF_TclLibs   Tcl)
+    elseif(UNIX)
+      set (CSF_TclLibs     "tcl8.6")
+      set (CSF_TclTkLibs   "tk8.6")
+    endif()
   endif()
+endif()
 
+# GL2PS
+if (NOT DEFINED ANDROID)
   if (USE_GL2PS)
-    set (CSF_GL2PS "gl2ps.lib")
+    set (CSF_GL2PS "gl2ps")
   else()
     set (CSF_GL2PS)
   endif()
+endif()
 
-  if (USE_FREEIMAGE)
-    set (CSF_FreeImagePlus "freeimage.lib")
+if (WIN32)
+  set (CSF_advapi32      "advapi32.lib")
+  set (CSF_gdi32         "gdi32.lib")
+  set (CSF_user32        "user32.lib")
+  set (CSF_wsock32       "wsock32.lib")
+  set (CSF_psapi         "Psapi.lib")
+  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" OR USE_GLES2)
+    set (CSF_OpenGlLibs  "libEGL libGLESv2")
   else()
-    set (CSF_FreeImagePlus)
-  endif()
-
-  if (USE_TCL)
-    set (CSF_TclLibs     "tcl${3RDPARTY_TCL_LIBRARY_VERSION}.lib")
-    set (CSF_TclTkLibs   "tk${3RDPARTY_TK_LIBRARY_VERSION}.lib")
+    set (CSF_OpenGlLibs  "opengl32.lib")
   endif()
 
-else()
+  else()
 
   if (APPLE)
     set (CSF_objc        "objc")
@@ -88,10 +93,6 @@ else()
       OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
     endif()
     
-    if (USE_TCL)
-      set (CSF_TclTkLibs Tk)
-      set (CSF_TclLibs   Tcl)
-    endif()
   elseif (ANDROID)
     set (CSF_ThreadLibs  "c")
     set (CSF_OpenGlLibs  "EGL GLESv2")
@@ -100,30 +101,5 @@ else()
     set (CSF_OpenGlLibs  "GL")
     set (CSF_XwLibs      "X11 Xext Xmu Xi")
     set (CSF_dl          "dl")
-
-    if (USE_TCL)
-      set (CSF_TclLibs     "tcl${3RDPARTY_TCL_LIBRARY_VERSION}")
-      set (CSF_TclTkLibs   "tk${3RDPARTY_TK_LIBRARY_VERSION}")
-    endif()
   endif()
-
-  if (USE_FREETYPE)
-    set (CSF_FREETYPE "freetype")
-  else()
-    set (CSF_FREETYPE)
-  endif()
-
-  if (USE_FREEIMAGE)
-    set (CSF_FreeImagePlus "freeimage")
-  else()
-    set (CSF_FreeImagePlus)
-  endif()
-
-  if (NOT DEFINED ANDROID)
-    if (USE_GL2PS)
-      set (CSF_GL2PS "gl2ps")
-    else()
-      set (CSF_GL2PS)
-    endif()
-  endif()
-endif()
\ No newline at end of file
+endif()
index 1381625..2385743 100644 (file)
@@ -424,7 +424,7 @@ function (OCCT_TOOLKIT_DEP TOOLKIT_NAME TOOLKIT_DEPS)
   set (LOCAL_TOOLKIT_DEPS)
   foreach (FILE_CONTENT_LINE ${FILE_CONTENT})
     string (REGEX MATCH "^TK" TK_FOUND ${FILE_CONTENT_LINE})
-    if ("${FILE_CONTENT_LINE}" STREQUAL "DRAWEXE" OR NOT "${TK_FOUND}" STREQUAL "")
+    if ("x${FILE_CONTENT_LINE}" STREQUAL "xDRAWEXE" OR NOT "${TK_FOUND}" STREQUAL "")
       list (APPEND LOCAL_TOOLKIT_DEPS ${FILE_CONTENT_LINE})
     endif()
   endforeach()
index b2d6205..b2b5a27 100644 (file)
@@ -220,9 +220,38 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
       else() # get CSF_ value
         set (CURRENT_CSF ${${USED_ITEM}})
         if (NOT "x${CURRENT_CSF}" STREQUAL "x")
-          # prepare a list from a string with whitespaces
+          set (LIBRARY_FROM_CACHE 0)
           separate_arguments (CURRENT_CSF)
-          list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
+          foreach (CSF_LIBRARY ${CURRENT_CSF})
+            string (TOLOWER "${CSF_LIBRARY}" CSF_LIBRARY)
+            string (REPLACE "+" "[+]" CSF_LIBRARY "${CSF_LIBRARY}")
+            string (REPLACE "." "" CSF_LIBRARY "${CSF_LIBRARY}")
+            get_cmake_property(ALL_CACHE_VARIABLES CACHE_VARIABLES)
+            string (REGEX MATCHALL "(^|;)3RDPARTY_[^;]+_LIBRARY[^;]*" ALL_CACHE_VARIABLES "${ALL_CACHE_VARIABLES}")
+            foreach (CACHE_VARIABLE ${ALL_CACHE_VARIABLES})
+              set (CURRENT_CACHE_LIBRARY ${${CACHE_VARIABLE}})
+              string (TOLOWER "${CACHE_VARIABLE}" CACHE_VARIABLE)
+
+              if (EXISTS "${CURRENT_CACHE_LIBRARY}" AND NOT IS_DIRECTORY "${CURRENT_CACHE_LIBRARY}")
+                string (REGEX MATCH "_${CSF_LIBRARY}$" IS_ENDING "${CACHE_VARIABLE}")
+                string (REGEX MATCH "^([a-z]+)" CSF_WO_VERSION "${CSF_LIBRARY}")
+                string (REGEX MATCH "_${CSF_WO_VERSION}$" IS_ENDING_WO_VERSION "${CACHE_VARIABLE}")
+                if ("3rdparty_${CSF_LIBRARY}_library" STREQUAL "${CACHE_VARIABLE}" OR
+                    "3rdparty_${CSF_WO_VERSION}_library" STREQUAL "${CACHE_VARIABLE}" OR
+                    NOT "x${IS_ENDING}" STREQUAL "x" OR
+                    NOT "x${IS_ENDING_WO_VERSION}" STREQUAL "x")
+                  list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "${CURRENT_CACHE_LIBRARY}")
+                  set (LIBRARY_FROM_CACHE 1)
+                endif()
+              endif()
+            endforeach()
+          endforeach()
+
+          if (NOT ${LIBRARY_FROM_CACHE})
+            # prepare a list from a string with whitespaces
+            separate_arguments (CURRENT_CSF)
+            list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
+          endif()
         endif()
       endif()
     endif()
index 6187396..52cff53 100644 (file)
@@ -70,49 +70,49 @@ else()
 endif()
 
 # common steps for tbb and tbbmalloc
-macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
+macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
 
-  string (TOLOWER ${PRODUCT_NAME} lower_PRODUCT_NAME)
+  string (TOUPPER ${PRODUCT_LIBRARY_NAME} upper_PRODUCT_LIBRARY_NAME)
 
   # define required tbb/tbbmalloc variables
-  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)
+  if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
+    set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_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")
+  if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
+    set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_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 (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
+      set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
     endif()
   endif()
 
-  if (WIN32 AND NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
-    set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library")
+  if (WIN32 AND NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
+    set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
   endif()
 
-  # check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_TBB_DIR
+  # check 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_ paths for consistency with specified 3RDPARTY_TBB_DIR
   if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
-    CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY FILEPATH "the path to ${PRODUCT_NAME} library")
+    CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY FILEPATH "the path to ${upper_PRODUCT_LIBRARY_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)
+    if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
+      get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH)
+      set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
     else()
-      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR PATH "The directory containing ${PRODUCT_NAME} library")
+      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library")
     endif()
 
     if (WIN32)
-      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${PRODUCT_NAME}_DLL FILEPATH "the path to ${PRODUCT_NAME} shared library")
+      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL FILEPATH "the path to ${upper_PRODUCT_LIBRARY_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)
+      if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
+        get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH)
+        set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
       else()
 
-      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR PATH "The directory containing ${PRODUCT_NAME} shared library")
+      CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
       endif()
     endif()
   endif()
@@ -121,112 +121,112 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
   OCCT_MAKE_COMPILER_BITNESS()
 
   if (${COMPILER_BITNESS} EQUAL 32)
-    set (${PRODUCT_NAME}_ARCH_NAME ia32)
+    set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME ia32)
   else()
-    set (${PRODUCT_NAME}_ARCH_NAME intel64)
+    set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME intel64)
   endif()
 
   # tbb/tbbmalloc library
-  if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
+  if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
     
     set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
-    set (PRODUCT_PATH_SUFFIXES lib ${lower_PRODUCT_NAME})
+    set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME})
 
-    # 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)
+    # set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY
+    set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
 
     if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
-      if (NOT EXISTS "${3RDPARTY_TBB_DIR}/lib/${${PRODUCT_NAME}_ARCH_NAME}/${COMPILER}")
-        if (EXISTS "${3RDPARTY_TBB_DIR}/lib/${${PRODUCT_NAME}_ARCH_NAME}")
-          file (GLOB ${PRODUCT_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/lib/${${PRODUCT_NAME}_ARCH_NAME}/*")
-          if (${PRODUCT_NAME}_COMPILER_LIST)
-            list (GET ${PRODUCT_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
+      if (NOT EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
+        if (EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
+          file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
+          if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
+            list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
             if (THE_MOST_FRESH_COMPILER_VERSION)
               get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
-              set (PRODUCT_PATH_SUFFIXES lib ${lower_PRODUCT_NAME} lib/${${PRODUCT_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
+              set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
             endif()
           endif()
         endif()
       else()
-        set (PRODUCT_PATH_SUFFIXES lib ${lower_PRODUCT_NAME} lib/${${PRODUCT_NAME}_ARCH_NAME}/${COMPILER})
+        set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER})
       endif()
 
-      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${lower_PRODUCT_NAME}
-                                         PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" "${3RDPARTY_TBB_DIR}"
+      find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME}
+                                         PATHS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" "${3RDPARTY_TBB_DIR}"
                                          PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
                                          CMAKE_FIND_ROOT_PATH_BOTH
                                          NO_DEFAULT_PATH)
     else()
-      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${lower_PRODUCT_NAME} 
+      find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME}
                                          PATH_SUFFIXES ${PRODUCT_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)
+    if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
+      get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH)
+      set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
     else()
-      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
+      set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_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}")
+  if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
+    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
 
-    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
+    set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
   endif()
 
   # tbb/tbbmalloc shared library
   if (WIN32)
-    if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
+    if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
       set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
       set (PRODUCT_PATH_SUFFIXES bin)
 
-      # 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 "${PRODUCT_NAME} shared library" FORCE)
+      # set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL
+      set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL-NOTFOUND" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
 
       if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
-        if (NOT EXISTS "${3RDPARTY_TBB_DIR}/bin/${${PRODUCT_NAME}_ARCH_NAME}/${COMPILER}")
-          if (EXISTS "${3RDPARTY_TBB_DIR}/bin/${${PRODUCT_NAME}_ARCH_NAME}")
-            file (GLOB ${PRODUCT_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/bin/${${PRODUCT_NAME}_ARCH_NAME}/*")
-            if (${PRODUCT_NAME}_COMPILER_LIST)
-              list (GET ${PRODUCT_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
+        if (NOT EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
+          if (EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
+            file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
+            if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
+              list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
               if (THE_MOST_FRESH_COMPILER_VERSION)
                 get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
-                set (PRODUCT_PATH_SUFFIXES bin bin/${${PRODUCT_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
+                set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
               endif()
             endif()
           endif()
         else()
-          set (PRODUCT_PATH_SUFFIXES bin bin/${${PRODUCT_NAME}_ARCH_NAME}/${COMPILER})
+          set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER})
         endif()
 
         if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
-          find_library (3RDPARTY_${PRODUCT_NAME}_DLL ${lower_PRODUCT_NAME}
+          find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME}
                                          PATHS "${3RDPARTY_TBB_DIR}"
                                          PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
                                          NO_DEFAULT_PATH)
         else()
-          find_library (3RDPARTY_${PRODUCT_NAME}_DLL ${lower_PRODUCT_NAME} PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES})
+          find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME} PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES})
         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_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
+          get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH)
+          set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
         else()
-          set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
+          set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
 
-          set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
+          set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
         endif()
       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_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
+      list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
     else()
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
+      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
     endif()
   endif()
 
@@ -237,47 +237,49 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
 
     if (WIN32)
       if (SINGLE_GENERATOR)
-        install (FILES ${3RDPARTY_${PRODUCT_NAME}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
+        install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
       else()
-        install (FILES ${3RDPARTY_${PRODUCT_NAME}_DLL}
+        install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
                  CONFIGURATIONS Release
                  DESTINATION "${INSTALL_DIR_BIN}")
-        install (FILES ${3RDPARTY_${PRODUCT_NAME}_DLL}
+        install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
                  CONFIGURATIONS RelWithDebInfo
                  DESTINATION "${INSTALL_DIR_BIN}i")
-        install (FILES ${3RDPARTY_${PRODUCT_NAME}_DLL}
+        install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
                  CONFIGURATIONS Debug
                  DESTINATION "${INSTALL_DIR_BIN}d")
       endif()
     else()
-      get_filename_component (PRODUCT_LIBRARY_NAME ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
+      get_filename_component (PRODUCT_LIBRARY_NAME ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY} NAME)
 
       if (SINGLE_GENERATOR)
-        install (FILES ${3RDPARTY_${PRODUCT_NAME}_LIBRARY}.2
+        install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
                  DESTINATION "${INSTALL_DIR_LIB}"
                  RENAME ${PRODUCT_LIBRARY_NAME}.2)
       else()
-        install (FILES ${3RDPARTY_${PRODUCT_NAME}_LIBRARY}.2
+        install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
                  CONFIGURATIONS Release
                  DESTINATION "${INSTALL_DIR_LIB}"
                  RENAME ${PRODUCT_LIBRARY_NAME}.2)
-        install (FILES ${3RDPARTY_${PRODUCT_NAME}_LIBRARY}.2
+        install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
                  CONFIGURATIONS RelWithDebInfo
                  DESTINATION "${INSTALL_DIR_LIB}i"
                  RENAME ${PRODUCT_LIBRARY_NAME}.2)
-        install (FILES ${3RDPARTY_${PRODUCT_NAME}_LIBRARY}.2
+        install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
                  CONFIGURATIONS Debug
                  DESTINATION "${INSTALL_DIR_LIB}d"
                  RENAME ${PRODUCT_LIBRARY_NAME}.2)
       endif()
     endif()
   endif()
-  mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
+  mark_as_advanced (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL)
 endmacro()
 
 if (BUILD_SHARED_LIBS)
-  TBB_PRODUCT_SEARCH (TBB)
-  TBB_PRODUCT_SEARCH (TBBMALLOC)
+  separate_arguments (CSF_TBB)
+  foreach (LIB IN LISTS CSF_TBB)
+    TBB_PRODUCT_SEARCH (${LIB})
+  endforeach()
 
   if (INSTALL_TBB)
     set (USED_3RDPARTY_TBB_DIR "")
index 2ce3eef..cde1015 100644 (file)
@@ -93,9 +93,9 @@ if (BUILD_SHARED_LIBS)
       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)
+      find_library (3RDPARTY_TCL_DLL NAMES ${CSF_TclLibs}
+                                           PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                           NO_DEFAULT_PATH)
     endif()
   endif()
 endif()
@@ -106,14 +106,14 @@ 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)
+    find_library (3RDPARTY_TCL_LIBRARY NAMES ${CSF_TclLibs}
+                                             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)
+    find_library (3RDPARTY_TCL_LIBRARY NAMES ${CSF_TclLibs}
+                                             PATHS "${3RDPARTY_TCL_DIR}/lib"
+                                             NO_DEFAULT_PATH)
 
 
     if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
@@ -161,8 +161,8 @@ if (BUILD_SHARED_LIBS)
 
       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)
+                                           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)
@@ -184,7 +184,7 @@ if (BUILD_SHARED_LIBS)
   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})
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY_DIR)
   endif()
 
   if (WIN32)
index 892e566..b751099 100644 (file)
@@ -97,9 +97,9 @@ if (BUILD_SHARED_LIBS)
         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)
+        find_library (3RDPARTY_TK_DLL NAMES ${CSF_TclTkLibs}
+                                            PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                            NO_DEFAULT_PATH)
     endif()
   endif()
 endif()
@@ -110,14 +110,14 @@ 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)
+    find_library (3RDPARTY_TK_LIBRARY NAMES ${CSF_TclTkLibs}
+                                            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)
+    find_library (3RDPARTY_TK_LIBRARY NAMES ${CSF_TclTkLibs}
+                                            PATHS "${3RDPARTY_TK_DIR}/lib"
+                                            NO_DEFAULT_PATH)
 
 
     if (NOT 3RDPARTY_TK_LIBRARY OR NOT EXISTS "${3RDPARTY_TK_LIBRARY}")
@@ -165,8 +165,8 @@ if (BUILD_SHARED_LIBS)
 
       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)
+                                          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)
@@ -190,7 +190,7 @@ 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_LIBRARY_DIR})
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_LIBRARY_DIR)
   endif()
 
   if (WIN32)