0027351: Custom OCCT DLL name suffixes
[occt.git] / adm / cmake / occt_macros.cmake
index b8c8359..057cac0 100644 (file)
@@ -576,3 +576,26 @@ macro (OCCT_INSERT_CODE_FOR_TARGET)
     set (OCCT_INSTALL_BIN_LETTER \"d\")
   endif()")
 endmacro()
+
+macro (OCCT_UPDATE_DRAW_DEFAULT_FILE)
+  install(CODE "cmake_policy(PUSH)
+  cmake_policy(SET CMP0007 NEW)
+  set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
+  file (STRINGS \"\${DRAW_DEFAULT_FILE_NAME}\" DRAW_DEFAULT_CONTENT)
+  file (REMOVE \"\${DRAW_DEFAULT_FILE_NAME}\")
+  foreach (line IN LISTS DRAW_DEFAULT_CONTENT)
+    string (REGEX MATCH \": TK\([a-zA-Z]+\)$\" IS_TK_LINE \"\${line}\")
+    string (REGEX REPLACE \": TK\([a-zA-Z]+\)$\" \": TK\${CMAKE_MATCH_1}${BUILD_SHARED_LIBRARY_NAME_POSTFIX}\" line \"\${line}\")
+    file (APPEND \"\${DRAW_DEFAULT_FILE_NAME}\" \"\${line}\\n\")
+  endforeach()
+  cmake_policy(POP)")
+endmacro()
+
+macro (OCCT_CREATE_SYMLINK_TO_FILE LIBRARY_NAME LINK_NAME)
+  if (NOT WIN32)
+    install (CODE "if (EXISTS \"${LIBRARY_NAME}\")
+        execute_process (COMMAND ln -s \"${LIBRARY_NAME}\" \"${LINK_NAME}\")
+      endif()
+    ")
+  endif()
+endmacro()