CMake: show install hint for ninja as well as make

Use the absolute destination path in the message too as the path
relative to the CMAKE_INSTALL_PREFIX isn't so meaningful.
This commit is contained in:
Campbell Barton
2023-06-22 20:27:31 +10:00
parent 16e187778b
commit 2ff522c23f

View File

@@ -547,16 +547,24 @@ if(WIN32)
endif()
endif()
# Helpful tip when using make.
# Show helpful tip.
set(_install_cmd "")
if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles.*")
set(_install_cmd "make install")
elseif("${CMAKE_GENERATOR}" MATCHES "Ninja")
set(_install_cmd "ninja install")
endif()
if(NOT ("${_install_cmd}" STREQUAL ""))
# Message to display after building.
get_filename_component(_install_dst ${TARGETDIR_VER} ABSOLUTE BASE_DIR ${CMAKE_INSTALL_PREFIX})
add_custom_command(
TARGET blender POST_BUILD MAIN_DEPENDENCY blender
COMMAND
${CMAKE_COMMAND} -E
echo 'now run: \"make install\" to copy runtime files and scripts to ${TARGETDIR_VER}'
COMMAND ${CMAKE_COMMAND} -E echo
"Run: \\\"${_install_cmd}\\\" to copy runtime files and scripts to: ${_install_dst}"
)
unset(_install_dst)
endif()
unset(_install_cmd)
# macro to help install files without dragging in unnecessary data.
macro(install_dir from to)