From: Szilard Pall Date: Wed, 23 Feb 2011 12:59:32 +0000 (+0100) Subject: added cmake warning when the cache generated on another host is reused X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=f337d63c0d667149b09a4757691939f23de74c94;p=alexxy%2Fgromacs.git added cmake warning when the cache generated on another host is reused --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 026b7a1849..8a7c41ea6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,22 @@ set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/admin/InstallInfo.txt") #must come after all cpack settings! include(CPack) +######################################################################## +# Check and warn if cache generated on a different host is being reused +######################################################################## +if(CMAKE_HOST_UNIX) + execute_process(COMMAND hostname + OUTPUT_VARIABLE TMP_HOSTNAME + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(GMX_BUILD_HOSTNAME AND NOT "${GMX_BUILD_HOSTNAME}" STREQUAL "${TMP_HOSTNAME}") + message(WARNING " + The CMake cache, probably generated on a different host (${GMX_BUILD_HOSTNAME}), + is being reused! This could lead to inconsitencies; therefore, it is + recommended to regenerate the cache!") + endif() + set(GMX_BUILD_HOSTNAME "${TMP_HOSTNAME}" CACHE INTERNAL + "Hostname of the machine where the cache was generated.") +endif() ######################################################################## # Fix stupid flags on MSVC