From ced0cd12d0dc8ec113e2139082b72e0ea964a567 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Thu, 16 Feb 2023 12:36:55 -0700 Subject: [PATCH] build: only use HOSTNAME_PRG if HOSTNAME is undefined (#22288) Allow specifying the HOSTNAME variable by defining it with -D when invoking CMake, instead of overriding it with the output of HOSTNAME_RPG. --- cmake.config/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake.config/CMakeLists.txt b/cmake.config/CMakeLists.txt index da7b2b9b45..9ae81074e7 100644 --- a/cmake.config/CMakeLists.txt +++ b/cmake.config/CMakeLists.txt @@ -188,7 +188,7 @@ elseif (NOT DEFINED USERNAME AND EXISTS ${WHOAMI_PRG}) endif() if (DEFINED ENV{HOSTNAME}) set(HOSTNAME $ENV{HOSTNAME}) -elseif (EXISTS ${HOSTNAME_PRG}) +elseif (NOT DEFINED HOSTNAME AND EXISTS ${HOSTNAME_PRG}) execute_process(COMMAND ${HOSTNAME_PRG} OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE HOSTNAME)