From bd6e49edf1ef6e6978a0947858869802ee3a2296 Mon Sep 17 00:00:00 2001 From: Daljit Date: Mon, 16 Dec 2024 13:53:30 +0000 Subject: [PATCH 1/2] Print build information at the end of configuration --- CMakeLists.txt | 3 +++ cmake/BuildInfo.cmake | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 cmake/BuildInfo.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 871b431545..60aa7fc63a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,6 +73,7 @@ file(RELATIVE_PATH relDir set(CMAKE_INSTALL_RPATH ${base} ${base}/${relDir}) include(BuildType) +include(BuildInfo) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git AND NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit) message(WARNING @@ -125,3 +126,5 @@ add_custom_target(Github SOURCES .github/workflows/package-windows-msys2.yml .github/workflows/clang-tidy.yml ) + +mrtrix_print_build_instructions() diff --git a/cmake/BuildInfo.cmake b/cmake/BuildInfo.cmake new file mode 100644 index 0000000000..6d60b4e23a --- /dev/null +++ b/cmake/BuildInfo.cmake @@ -0,0 +1,14 @@ +function(mrtrix_print_build_instructions) + set(message_list "\n") + list(APPEND message_list "MRtrix3 has been successfully configured for compilation.") + list(APPEND message_list "To build MRtrix3, run 'cmake --build .' from the build directory.") + + list(APPEND message_list "To reconfigure the project, run CMake again with the same arguments.") + list(APPEND message_list "If reconfiguration fails, remove the CMakeCache.txt file in the build " + "directory or run CMake adding the --fresh flag.") + list(APPEND message_list "\n") + + # Remove ; from list and add two spaces to the beginning of each line + string(REPLACE ";" "\n " message_list "${message_list}") + message(STATUS "${message_list}") +endfunction() From de4bee8bb31445db1d37ea77a83dc281c5b76445 Mon Sep 17 00:00:00 2001 From: Daljit Singh Date: Tue, 17 Dec 2024 13:44:20 +0000 Subject: [PATCH 2/2] Instruct to use 'cmake --build build' --- cmake/BuildInfo.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/BuildInfo.cmake b/cmake/BuildInfo.cmake index 6d60b4e23a..8e6b061163 100644 --- a/cmake/BuildInfo.cmake +++ b/cmake/BuildInfo.cmake @@ -1,7 +1,8 @@ function(mrtrix_print_build_instructions) set(message_list "\n") + file(RELATIVE_PATH relative_build_path "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}") list(APPEND message_list "MRtrix3 has been successfully configured for compilation.") - list(APPEND message_list "To build MRtrix3, run 'cmake --build .' from the build directory.") + list(APPEND message_list "To build it, run 'cmake --build ${relative_build_path}'") list(APPEND message_list "To reconfigure the project, run CMake again with the same arguments.") list(APPEND message_list "If reconfiguration fails, remove the CMakeCache.txt file in the build "