diff options
author | Brad King <brad.king@kitware.com> | 2024-05-01 15:25:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-05-01 15:25:28 (GMT) |
commit | 68a8c89430d94e89cf0044e6f3775fb61d447594 (patch) | |
tree | eba107a41e31c7699279cc5f43f6c3e7da8afa9d /Modules | |
parent | 0ccc9f519dc00891fadb9e9189a652013b7c30e2 (diff) | |
download | CMake-68a8c89430d94e89cf0044e6f3775fb61d447594.zip CMake-68a8c89430d94e89cf0044e6f3775fb61d447594.tar.gz CMake-68a8c89430d94e89cf0044e6f3775fb61d447594.tar.bz2 |
FPHSA: Add hint for failure when called before project()
Help project authors recognize an ordering mistake.
Inspired-by: Jeremy Rifkin @jeremy-rifkin
Closes: #25941
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindPackageHandleStandardArgs.cmake | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index 63b2bf2..c6db433 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -225,6 +225,9 @@ macro(_FPHSA_FAILURE_MESSAGE _msg) set (__msg "${_msg}") if (FPHSA_REASON_FAILURE_MESSAGE) string(APPEND __msg "\n Reason given by package: ${FPHSA_REASON_FAILURE_MESSAGE}\n") + elseif(NOT DEFINED PROJECT_NAME) + string(APPEND __msg "\n" + "Hint: The project() command has not yet been called. It sets up system-specific search paths.") endif() if (${_NAME}_FIND_REQUIRED) message(FATAL_ERROR "${__msg}") |