Fix CMake namespace pollution
authorMark Abraham <mark.j.abraham@gmail.com>
Sat, 9 Feb 2013 16:35:11 +0000 (17:35 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Mon, 18 Feb 2013 21:16:47 +0000 (22:16 +0100)
When gmxManageMPI finds MPI and CMake version is less than 2.8.10,
the variable file_cmd ends up in the non-advanced CMake namespace.
Made it advanced in those cases.

Change-Id: I79fd46e1b66d6c5ab008973e654092939eeae4dc

cmake/gmxManageMPI.cmake

index 30d51b47a004833e7bbd3eb846a202966530a29a..28d23d837b7a404c21dc54bb8c7b8e6c5b95292c 100644 (file)
@@ -143,6 +143,14 @@ if(GMX_MPI)
     endif()
     unset(MPINAME_BIN CACHE)
 
+    # Using find_file() runs the CMake standard module
+    # GetPrerequisites.cmake, which adds the file_cmd
+    # variable to the top-level CMake namespace. This is
+    # fixed in CMake 2.8.10. Meanwhile, clean up for it.
+    if(CMAKE_VERSION VERSION_LESS "2.8.10")
+        mark_as_advanced(file_cmd)
+    endif()
+
   else(MPI_FOUND)
     if (CMAKE_VERSION VERSION_LESS "2.8.5")
       message(FATAL_ERROR