| 1 |
# |
| 2 |
# Robust install cmake -P script that will ensure that 'cmake -P |
| 3 |
# cmake_install.cmake' gets called in every package directory if the global |
| 4 |
# 'cmake -P cmake_install.cmake' command fails. |
| 5 |
# |
| 6 |
|
| 7 |
set(PROJECT_BINARY_DIR @PROJECT_BINARY_DIR@) |
| 8 |
set(TRIBITS_ENABLED_PACKAGES_BINARY_DIRS @TRIBITS_ENABLED_PACKAGES_BINARY_DIRS@) |
| 9 |
|
| 10 |
execute_process( |
| 11 |
COMMAND @CMAKE_COMMAND@ -P "cmake_install.cmake" |
| 12 |
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}" |
| 13 |
RESULT_VARIABLE global_install_rtn) |
| 14 |
|
| 15 |
if (NOT global_install_rtn EQUAL 0) |
| 16 |
|
| 17 |
message(SEND_ERROR "Error, full install failed!") |
| 18 |
|
| 19 |
message( |
| 20 |
"\n" |
| 21 |
"***\n" |
| 22 |
"*** The global install failed so resorting to package-by-package installs\n" |
| 23 |
"***\n" |
| 24 |
) |
| 25 |
|
| 26 |
foreach (pkg_binary_dir ${TRIBITS_ENABLED_PACKAGES_BINARY_DIRS}) |
| 27 |
message("\nRunning install commands for '${pkg_binary_dir}/':") |
| 28 |
execute_process(COMMAND @CMAKE_COMMAND@ -P cmake_install.cmake |
| 29 |
WORKING_DIRECTORY ${pkg_binary_dir} |
| 30 |
RESULT_VARIABLE pkg_install_rtn) |
| 31 |
endforeach() |
| 32 |
|
| 33 |
message("\nRunning install commands for 'add_project_install_commands/':") |
| 34 |
execute_process(COMMAND @CMAKE_COMMAND@ -P cmake_install.cmake |
| 35 |
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/add_project_install_commands" |
| 36 |
RESULT_VARIABLE project_install_rtn) |
| 37 |
|
| 38 |
set(set_installed_group_and_permissions_file |
| 39 |
"${PROJECT_BINARY_DIR}/set_installed_group_and_permissions.cmake") |
| 40 |
if (EXISTS "${set_installed_group_and_permissions_file}") |
| 41 |
message("\nFixing up group and/or permissions of installed files and dirs:") |
| 42 |
execute_process( |
| 43 |
COMMAND @CMAKE_COMMAND@ -P "${set_installed_group_and_permissions_file}" |
| 44 |
RESULT_VARIABLE set_installed_rtn) |
| 45 |
if (NOT set_installed_rtn EQUAL 0) |
| 46 |
message(SEND_ERROR "ERROR: Fixup of group and permissions filed!") |
| 47 |
endif() |
| 48 |
endif() |
| 49 |
# NOTE: If the global install did not fail, then the group and permissions |
| 50 |
# would get fixed up since it gets run as part of the default 'install' |
| 51 |
# target. Therefore, there is no need to run this if the 'install' target |
| 52 |
# passed. |
| 53 |
|
| 54 |
endif() |