From: vsr Date: Fri, 1 Oct 2021 12:24:25 +0000 (+0300) Subject: bos #24474 Add possibility to create relative symbolic links X-Git-Tag: V9_8_0a2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=98b2f464468c5e4d049f607400e26a5bb07860dd;p=tools%2Fdocumentation.git bos #24474 Add possibility to create relative symbolic links --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0472810..9957c65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,8 @@ INCLUDE(CMakeDependentOption) OPTION(SALOME_INSTALL_MODULES_DOC "Install documentation of SALOME modules" OFF) CMAKE_DEPENDENT_OPTION(SALOME_CREATE_SYMLINKS "Create symlinks instead of installing docs" OFF "NOT WIN32;SALOME_INSTALL_MODULES_DOC" OFF) +CMAKE_DEPENDENT_OPTION(SALOME_RELATIVE_SYMLINKS "Make relative symlinks instead of absolute ones" OFF + "NOT WIN32;SALOME_INSTALL_MODULES_DOC;SALOME_CREATE_SYMLINKS" OFF) # Find prerequisites needed to documentation generation # ===================================================== diff --git a/cmake/DocumentationMacros.cmake b/cmake/DocumentationMacros.cmake index 6c8cfb3..51937c0 100644 --- a/cmake/DocumentationMacros.cmake +++ b/cmake/DocumentationMacros.cmake @@ -13,6 +13,11 @@ # ============================================================================== MACRO(SALOME_CREATE_SYMLINK src_path link_path) + IF(SALOME_RELATIVE_SYMLINKS) + FILE(RELATIVE_PATH _link "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${link_path}/.." "${src_path}") + ELSE() + SET(_link "${src_path}") + ENDIF() INSTALL(CODE " IF(EXISTS \"${src_path}\") MESSAGE(STATUS \"Creating symbolic link \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${link_path}\") @@ -20,7 +25,8 @@ MACRO(SALOME_CREATE_SYMLINK src_path link_path) EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory \"\${_path}\") EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"${src_path}\" \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${link_path}\") + \"${_link}\" \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${link_path}\" + WORKING_DIRECTORY \"${_path}\") ENDIF() ") ENDMACRO()