cmake: add symlink kdb.1 to kdb-static.1
@@ -15,7 +15,7 @@ endmacro (copy_file)
# - JAVA: install symlink for Java in share/java
# - otherwise: install symlink for normal libraries
#
-# create_lib_symlink src dest - create a symbolic link from src -> dest
+# create_lib_symlink src dest component - create a symbolic link from src -> dest
# ~~~
macro (create_lib_symlink src dest component)
@@ -68,6 +68,50 @@ macro (create_lib_symlink src dest component)
COMPONENT "${component}")
endmacro (create_lib_symlink src dest component)
+
+# ~~~
+# Create a symlink for man1 files at installation
+#
+# create_lib_symlink src dest component - create a symbolic link from src -> dest
+# ~~~
+macro (create_doc_symlink src dest component)
+
+ cmake_parse_arguments (
+ ARG
+ "" # optional keywords
+ "" # one value keywords
+ "" # multi value keywords
+ ${ARGN})
+
+ set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/man/man1")
+
+ install (
+ CODE "
+ message (STATUS \"Installing symlink: \$ENV{DESTDIR}${DOC_INSTALL_DIR}/${dest} -> ${src}\")
+ execute_process (COMMAND \"${CMAKE_COMMAND}\" -E make_directory
+ \"\$ENV{DESTDIR}${DOC_INSTALL_DIR}\"
+ RESULT_VARIABLE RET
+ )
+ if (RET)
+ message (WARNING \"Could not create directory\")
+ endif ()
+ execute_process (COMMAND \"${CMAKE_COMMAND}\" -E create_symlink
+ \"${src}\"
+ \"${dest}\"
+ WORKING_DIRECTORY \"\$ENV{DESTDIR}${DOC_INSTALL_DIR}\"
+ RESULT_VARIABLE RET
+ )
+
+ # for uninstall:
+ file (APPEND \"${CMAKE_BINARY_DIR}/extra_install_manifest.txt\" \"\$ENV{DESTDIR}${DOC_INSTALL_DIR}/${dest}\\n\")
+
+ if (RET)
+ message (WARNING \"Could not install symlink\")
+ endif ()
+ "
+ COMPONENT "${component}")
+endmacro (create_doc_symlink src dest component)
+
# ~~~
# Make a directory
#
@@ -608,6 +652,12 @@ If you do not add this file, then installing Elektra will fail!\n")
FILES ${OUTFILE}
DESTINATION share/man/man${SECTION}
COMPONENT "${ARG_COMPONENT}")
+
+ if (BUILD_STATIC)
+ if (SECTION EQUAL 1)
+ create_doc_symlink("kdb.${SECTION}" "kdb-static.${SECTION}" "${ARG_COMPONENT}")
+ endif()
+ endif ()
endif ()
endif (BUILD_DOCUMENTATION)
endfunction ()
