From ff64242a2be0bd8bfd338e42f61a5440c4eb91ed Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Tue, 10 Feb 2015 15:27:30 +0100
Subject: [PATCH] Empty endblock statements in CMake.

Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block.  This is no longer the preferred style.

Run the following shell code:

for c in else endif endforeach endfunction endmacro endwhile; do
    echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
---
 Applications/CLI/Tests.cmake                  |   8 +-
 Applications/DataExplorer/DataExplorer.cmake  |   8 +-
 .../DataExplorer/DataView/CMakeLists.txt      |   2 +-
 CMakeLists.txt                                |   2 +-
 FileIO/CMakeLists.txt                         |   2 +-
 MeshLib/CMakeLists.txt                        |   2 +-
 SimpleTests/MatrixTests/CMakeLists.txt        |  10 +-
 SimpleTests/MeshTests/MPI/CMakeLists.txt      |   2 +-
 SimpleTests/SolverTests/CMakeLists.txt        |   8 +-
 Tests/CMakeLists.txt                          |   2 +-
 scripts/cmake/CompilerSetup.cmake             |   8 +-
 scripts/cmake/Find.cmake                      |   6 +-
 scripts/cmake/Functions.cmake                 |   2 +-
 scripts/cmake/cmake/FindBLAS.cmake            | 156 +++++++++---------
 scripts/cmake/cmake/FindEigen3.cmake          |  22 +--
 scripts/cmake/cmake/FindLAPACK.cmake          | 112 ++++++-------
 scripts/cmake/cmake/FindMSVCRedist.cmake      |   6 +-
 scripts/cmake/cmake/FindMsysGit.cmake         |   2 +-
 scripts/cmake/cmake/FindNetCDF.cmake          |  10 +-
 .../cmake/cmake/FindOpenSGSupportlibs.cmake   |   8 +-
 scripts/cmake/cmake/FindQVTK.cmake            |   4 +-
 scripts/cmake/cmake/LibFindMacros.cmake       |  48 +++---
 .../cmake/ListAllCMakeVariableValues.cmake    |   2 +-
 .../SelectLibraryConfigurations.cmake         |  14 +-
 .../cmake-2.8.4-modules/boost/FindBoost.cmake | 138 ++++++++--------
 .../cmake/findPETSC/CorrectWindowsPaths.cmake |   4 +-
 scripts/cmake/findPETSC/FindPETSc.cmake       |  50 +++---
 .../findPETSC/FindPackageMultipass.cmake      |  22 +--
 .../findPETSC/ResolveCompilerPaths.cmake      |  26 +--
 29 files changed, 343 insertions(+), 343 deletions(-)

diff --git a/Applications/CLI/Tests.cmake b/Applications/CLI/Tests.cmake
index 99a4fd16b87..b5b3098e1eb 100644
--- a/Applications/CLI/Tests.cmake
+++ b/Applications/CLI/Tests.cmake
@@ -14,7 +14,7 @@ foreach(mesh_size 1e0 1e1 1e2 1e3)
 		DIFF_DATA cube_${mesh_size}_result.dat
 		DATA cube_${mesh_size}.prj cube_1x1x1_hex_${mesh_size}.vtu cube_1x1x1.gml
 	)
-endforeach(mesh_size)
+endforeach()
 
 foreach(mesh_size 2e4 3e4 4e4 5e4 1e5 1e6)
 	AddTest(
@@ -27,7 +27,7 @@ foreach(mesh_size 2e4 3e4 4e4 5e4 1e5 1e6)
 		DIFF_DATA cube_${mesh_size}_result.dat
 		DATA cube_${mesh_size}.prj cube_1x1x1_hex_${mesh_size}.vtu cube_1x1x1.gml
 	)
-endforeach(mesh_size)
+endforeach()
 
 # SQUARE 1x1 GROUNDWATER FLOW TESTS
 foreach(mesh_size 1e0 1e1 1e2 1e3)
@@ -41,7 +41,7 @@ foreach(mesh_size 1e0 1e1 1e2 1e3)
 		DIFF_DATA square_${mesh_size}_result.dat
 		DATA square_${mesh_size}.prj square_1x1_quad_${mesh_size}.vtu square_1x1.gml
 	)
-endforeach(mesh_size)
+endforeach()
 
 foreach(mesh_size 1e5 1e6)
 	AddTest(
@@ -54,4 +54,4 @@ foreach(mesh_size 1e5 1e6)
 		DIFF_DATA square_${mesh_size}_result.dat
 		DATA square_${mesh_size}.prj square_1x1_quad_${mesh_size}.vtu square_1x1.gml
 	)
-endforeach(mesh_size)
+endforeach()
diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake
index 0357dcde294..01a28821197 100644
--- a/Applications/DataExplorer/DataExplorer.cmake
+++ b/Applications/DataExplorer/DataExplorer.cmake
@@ -115,7 +115,7 @@ if(MSVC)
 	# Set linker flags
 	set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:MSVCRT /IGNORE:4099")
 	target_link_libraries( DataExplorer winmm)
-endif(MSVC)
+endif()
 
 ### OpenSG support ###
 if (VTKOSGCONVERTER_FOUND)
@@ -163,9 +163,9 @@ endif()
 
 if(MSVC)
 	set(OGS_GUI_EXE ${EXECUTABLE_OUTPUT_PATH}/Release/DataExplorer.exe)
-else(MSVC)
+else()
 	set(OGS_GUI_EXE ${EXECUTABLE_OUTPUT_PATH}/DataExplorer)
-endif(MSVC)
+endif()
 
 include(GetPrerequisites)
 if(EXISTS ${OGS_GUI_EXE})
@@ -185,7 +185,7 @@ if(EXISTS ${OGS_GUI_EXE})
 				message("    ${DEPENDENCY}")
 			endif()
 		endif()
-	endforeach (DEPENDENCY IN ${OGS_GUI_DEPENDENCIES})
+	endforeach ()
 	install (FILES ${DEPENDENCY_PATHS} DESTINATION bin COMPONENT ogs_gui)
 	if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 		install(PROGRAMS data-explorer.sh DESTINATION . COMPONENT ogs_gui)
diff --git a/Applications/DataExplorer/DataView/CMakeLists.txt b/Applications/DataExplorer/DataView/CMakeLists.txt
index a350d112970..9ecb100b578 100644
--- a/Applications/DataExplorer/DataView/CMakeLists.txt
+++ b/Applications/DataExplorer/DataView/CMakeLists.txt
@@ -156,7 +156,7 @@ include_directories(
 
 if (VTKOSGCONVERTER_FOUND)
 	include_directories( ${VTKOSGCONVERTER_INCLUDE_DIRS} )
-endif (VTKOSGCONVERTER_FOUND)
+endif ()
 
 if (GEOTIFF_FOUND)
 	include_directories( ${GEOTIFF_INCLUDE_DIRS} )
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4be6664bf01..7fd4695a645 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,7 +79,7 @@ set(OGS_CXX_FLAGS "" CACHE STRING "Additional C++ compiler flags.")
 if (OGS_CMAKE_DEBUG)
 	include(ListAllCMakeVariableValues)
 	list_all_cmake_variable_values()
-endif (OGS_CMAKE_DEBUG)
+endif ()
 
 # Code coverage
 option(OGS_COVERAGE "Enables code coverage measurements with gcov/lcov." OFF)
diff --git a/FileIO/CMakeLists.txt b/FileIO/CMakeLists.txt
index 7d8fdcb743e..a01d4bc3301 100644
--- a/FileIO/CMakeLists.txt
+++ b/FileIO/CMakeLists.txt
@@ -37,7 +37,7 @@ if (QT4_FOUND)
 	set ( SOURCES ${SOURCES} FEFLOWInterface.h FEFLOWInterface.cpp)
 	GET_SOURCE_FILES(SOURCES_QT_XML XmlIO/Qt)
 	set ( SOURCES ${SOURCES} ${SOURCES_QT_XML})
-endif (QT4_FOUND)
+endif ()
 
 # It could be used for other MPI based DDC approach in future.
 if(OGS_USE_PETSC)
diff --git a/MeshLib/CMakeLists.txt b/MeshLib/CMakeLists.txt
index e317c12202d..9b6a91435bb 100644
--- a/MeshLib/CMakeLists.txt
+++ b/MeshLib/CMakeLists.txt
@@ -4,7 +4,7 @@ GET_SOURCE_FILES(SOURCES_MESHLIB)
 # It should be removed too for other MPI based DDC approach in future.
 if(NOT OGS_USE_PETSC)
 	list(REMOVE_ITEM SOURCES_MESHLIB NodePartitionedMesh.h)
-endif(NOT OGS_USE_PETSC)
+endif()
 
 GET_SOURCE_FILES(SOURCES_ELEMENTS Elements)
 GET_SOURCE_FILES(SOURCES_EDITING MeshEditing)
diff --git a/SimpleTests/MatrixTests/CMakeLists.txt b/SimpleTests/MatrixTests/CMakeLists.txt
index 8d6d6c667fa..b07fac5017b 100644
--- a/SimpleTests/MatrixTests/CMakeLists.txt
+++ b/SimpleTests/MatrixTests/CMakeLists.txt
@@ -5,7 +5,7 @@ endif()
 
 if ( CMAKE_USE_PTHREADS_INIT )
         set (HAVE_PTHREADS TRUE)
-endif (CMAKE_USE_PTHREADS_INIT )
+endif ()
 
 include_directories(
         .
@@ -35,7 +35,7 @@ target_link_libraries(MatVecMultPthreads
 	BaseLib
 	MathLib
 	logog)
-endif ( HAVE_PTHREADS )
+endif ()
 
 set_target_properties(MatMult PROPERTIES FOLDER SimpleTests)
 target_link_libraries(MatMult logog)
@@ -80,12 +80,12 @@ if (METIS_FOUND)
 			${ADDITIONAL_LIBS}
 		)
 	endif()
-endif(METIS_FOUND)
+endif()
 
 
 if (WIN32)
         target_link_libraries(MatMult Winmm.lib)
-endif (WIN32)
+endif ()
 
 target_link_libraries ( MatMult
 	BaseLib
@@ -94,7 +94,7 @@ target_link_libraries ( MatMult
 
 if (WIN32)
         target_link_libraries(MatTestRemoveRowsCols Winmm.lib)
-endif (WIN32)
+endif ()
 
 target_link_libraries ( MatTestRemoveRowsCols
 	BaseLib
diff --git a/SimpleTests/MeshTests/MPI/CMakeLists.txt b/SimpleTests/MeshTests/MPI/CMakeLists.txt
index 01736f26116..3638647cb84 100644
--- a/SimpleTests/MeshTests/MPI/CMakeLists.txt
+++ b/SimpleTests/MeshTests/MPI/CMakeLists.txt
@@ -21,7 +21,7 @@ target_link_libraries ( test_node_partitioned_mesh
 
 if (OGS_USE_PETSC)
 	target_link_libraries( test_node_partitioned_mesh  ${PETSC_LIBRARIES})
-endif (OGS_USE_PETSC)
+endif ()
 
 if (OGS_USE_MPI)
 	target_link_libraries( test_node_partitioned_mesh  ${MPI_CXX_LIBRARIES})
diff --git a/SimpleTests/SolverTests/CMakeLists.txt b/SimpleTests/SolverTests/CMakeLists.txt
index a82a719e1bd..f75e110e902 100644
--- a/SimpleTests/SolverTests/CMakeLists.txt
+++ b/SimpleTests/SolverTests/CMakeLists.txt
@@ -36,7 +36,7 @@ set_target_properties(GMResDiagPrecond PROPERTIES FOLDER SimpleTests)
 
 if (WIN32)
         target_link_libraries(ConjugateGradientUnpreconditioned Winmm.lib)
-endif (WIN32)
+endif ()
 target_link_libraries ( ConjugateGradientUnpreconditioned
         ${BLAS_LIBRARIES}
         ${LAPACK_LIBRARIES}
@@ -46,7 +46,7 @@ target_link_libraries ( ConjugateGradientUnpreconditioned
 
 if (WIN32)
         target_link_libraries(ConjugateGradientDiagPrecond Winmm.lib)
-endif (WIN32)
+endif ()
 target_link_libraries ( ConjugateGradientDiagPrecond
         ${BLAS_LIBRARIES}
         ${LAPACK_LIBRARIES}
@@ -56,7 +56,7 @@ target_link_libraries ( ConjugateGradientDiagPrecond
 
 if (WIN32)
         target_link_libraries(BiCGStabDiagPrecond Winmm.lib)
-endif (WIN32)
+endif ()
 target_link_libraries( BiCGStabDiagPrecond
         ${BLAS_LIBRARIES}
         ${LAPACK_LIBRARIES}
@@ -66,7 +66,7 @@ target_link_libraries( BiCGStabDiagPrecond
 
 if (WIN32)
         target_link_libraries(GMResDiagPrecond Winmm.lib)
-endif (WIN32)
+endif ()
 target_link_libraries( GMResDiagPrecond
         ${BLAS_LIBRARIES}
         ${LAPACK_LIBRARIES}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 78286dcc574..cc40706af31 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -57,7 +57,7 @@ target_link_libraries(testrunner
 ADD_CATALYST_DEPENDENCY(testrunner)
 if (OGS_USE_PETSC)
 	target_link_libraries( testrunner  ${PETSC_LIBRARIES})
-endif (OGS_USE_PETSC)
+endif ()
 
 if (OGS_USE_MPI)
 	target_link_libraries( testrunner  ${MPI_CXX_LIBRARIES})
diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake
index 4db84fc1c70..db2b5eaff86 100644
--- a/scripts/cmake/CompilerSetup.cmake
+++ b/scripts/cmake/CompilerSetup.cmake
@@ -71,7 +71,7 @@ if (OGS_PROFILE)
 		set(PROFILE_FLAGS "${PROFILE_FLAGS} -fno-inline-functions-called-once -fno-optimize-sibling-calls")
 	endif()
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROFILE_FLAGS}")
-endif (OGS_PROFILE)
+endif ()
 
 ### Windows
 if (WIN32)
@@ -90,11 +90,11 @@ if (WIN32)
 
 		DisableCompilerFlag(DEBUG /RTC1)
 	# cygwin
-	else (MSVC)
+	else ()
 		message (STATUS "Might be GCC under cygwin.")
 		add_definitions( -DGCC )
-	endif (MSVC)
-endif (WIN32)
+	endif ()
+endif ()
 
 # Missing OpenMP 3.0 implementation fix for Windows, this fixes #6
 if(MSVC)
diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake
index 842d09be177..2a603873cf1 100644
--- a/scripts/cmake/Find.cmake
+++ b/scripts/cmake/Find.cmake
@@ -83,7 +83,7 @@ find_package(Metis QUIET)
 ## Qt4 library ##
 if(NOT OGS_DONT_USE_QT)
 	find_package( Qt4 4.7)
-endif(NOT OGS_DONT_USE_QT)
+endif()
 
 if ( QT4_FOUND )
 	# Enable more modules
@@ -94,7 +94,7 @@ if ( QT4_FOUND )
 	set(QT_USE_QTXMLPATTERNS TRUE)
 	include( ${QT_USE_FILE} )
 	add_definitions(${QT_DEFINITIONS} -DQT4_FOUND)
-endif (QT4_FOUND )
+endif ()
 
 ## pthread ##
 set ( CMAKE_THREAD_PREFER_PTHREAD ON )
@@ -102,7 +102,7 @@ find_package ( Threads )
 if ( CMAKE_USE_PTHREADS_INIT )
 	set (HAVE_PTHREADS TRUE)
 	add_definitions(-DHAVE_PTHREADS)
-endif (CMAKE_USE_PTHREADS_INIT )
+endif ()
 
 # blas
 #find_package ( BLAS QUIET )
diff --git a/scripts/cmake/Functions.cmake b/scripts/cmake/Functions.cmake
index a862b2529b7..fdeab6ff1ba 100644
--- a/scripts/cmake/Functions.cmake
+++ b/scripts/cmake/Functions.cmake
@@ -54,6 +54,6 @@ macro(ADD_GOOGLE_TESTS executable)
 			string(REGEX REPLACE ".*\\(([A-Za-z_0-9]+)[, ]*([A-Za-z_0-9]+)\\).*" "\\1.\\2" test_name ${hit})
 			add_test(${test_name} ${executable}  --gtest_output=xml --gtest_filter=${test_name} ${MI3CTestingDir})
 			# message ("Adding test: ${test_name}")
-		endforeach(hit)
+		endforeach()
 	endforeach()
 endmacro()
diff --git a/scripts/cmake/cmake/FindBLAS.cmake b/scripts/cmake/cmake/FindBLAS.cmake
index bc11928c5ac..8e273e397b0 100644
--- a/scripts/cmake/cmake/FindBLAS.cmake
+++ b/scripts/cmake/cmake/FindBLAS.cmake
@@ -64,36 +64,36 @@ foreach(_library ${_list})
    if ( WIN32 )
     if(BLA_STATIC)
       set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
-    endif(BLA_STATIC)
+    endif()
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
     PATHS ENV LIB
     )
-   endif ( WIN32 )
+   endif ()
 
    if ( APPLE )
     if(BLA_STATIC)
      set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
-    endif(BLA_STATIC)
+    endif()
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
     PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
     )
 
-   else ( APPLE )
+   else ()
     if(BLA_STATIC)
       set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
-    endif(BLA_STATIC)
+    endif()
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
     PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
     )
-   endif( APPLE )
+   endif()
     mark_as_advanced(${_prefix}_${_library}_LIBRARY)
     set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
     set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
-  endif(_libraries_work)
-endforeach(_library ${_list})
+  endif()
+endforeach()
 if(_libraries_work)
   # Test this combination of libraries.
   set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads})
@@ -102,23 +102,23 @@ if(_libraries_work)
   set(CMAKE_REQUIRED_LIBRARIES)
   mark_as_advanced(${_prefix}${_combined_name}_WORKS)
   set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
-endif(_libraries_work)
+endif()
 if(NOT _libraries_work)
   set(${LIBRARIES} FALSE)
-endif(NOT _libraries_work)
+endif()
 #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
-endmacro(Check_Fortran_Libraries)
+endmacro()
 
 set(BLAS_LINKER_FLAGS)
 set(BLAS_LIBRARIES)
 set(BLAS95_LIBRARIES)
 if ($ENV{BLA_VENDOR} MATCHES ".+")
   set(BLA_VENDOR $ENV{BLA_VENDOR})
-else ($ENV{BLA_VENDOR} MATCHES ".+")
+else ()
   if(NOT BLA_VENDOR)
     set(BLA_VENDOR "All")
-  endif(NOT BLA_VENDOR)
-endif ($ENV{BLA_VENDOR} MATCHES ".+")
+  endif()
+endif ()
 
 if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
  if(NOT BLAS_LIBRARIES)
@@ -131,8 +131,8 @@ if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
   "cblas;f77blas;atlas"
   ""
   )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
+ endif()
+endif ()
 
 # BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
 if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
@@ -145,8 +145,8 @@ if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
   "sgemm;dgemm;blas"
   ""
   )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
+ endif()
+endif ()
 
 # BLAS in Alpha CXML library?
 if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
@@ -159,8 +159,8 @@ if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
   "cxml"
   ""
   )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
+ endif()
+endif ()
 
 # BLAS in Alpha DXML library? (now called CXML, see above)
 if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
@@ -173,8 +173,8 @@ if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
   "dxml"
   ""
   )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
+ endif()
+endif ()
 
 # BLAS in Sun Performance library?
 if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
@@ -189,9 +189,9 @@ if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
   )
   if(BLAS_LIBRARIES)
     set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
-  endif(BLAS_LIBRARIES)
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
+  endif()
+ endif()
+endif ()
 
 # BLAS in SCSL library?  (SGI/Cray Scientific Library)
 if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
@@ -204,8 +204,8 @@ if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
   "scsl"
   ""
   )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
+ endif()
+endif ()
 
 # BLAS in SGIMATH library?
 if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
@@ -218,8 +218,8 @@ if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
   "complib.sgimath"
   ""
   )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
+ endif()
+endif ()
 
 # BLAS in IBM ESSL library? (requires generic BLAS lib, too)
 if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
@@ -232,8 +232,8 @@ if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
   "essl;blas"
   ""
   )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
+ endif()
+endif ()
 
 #BLAS in acml library?
 if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
@@ -246,8 +246,8 @@ if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
   "acml_mp;acml_mv"
   ""
   )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
+ endif()
+endif ()
 
 # Apple BLAS library?
 if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
@@ -260,8 +260,8 @@ if(NOT BLAS_LIBRARIES)
   "Accelerate"
   ""
   )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
+ endif()
+endif ()
 
 if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
  if ( NOT BLAS_LIBRARIES )
@@ -273,8 +273,8 @@ if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
     "vecLib"
     ""
     )
- endif ( NOT BLAS_LIBRARIES )
-endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
+ endif ()
+endif ()
 # Generic BLAS library?
 if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
  if(NOT BLAS_LIBRARIES)
@@ -286,8 +286,8 @@ if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
   "blas"
   ""
   )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
+ endif()
+endif ()
 
 #BLAS in intel mkl 10 library? (em64t 64bit)
 if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
@@ -297,9 +297,9 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
  if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
   if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
     find_package(Threads)
-  else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
+  else()
     find_package(Threads REQUIRED)
-  endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
+  endif()
   if (WIN32)
   if(BLA_F95)
     if(NOT BLAS95_LIBRARIES)
@@ -311,8 +311,8 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
     "mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40"
     ""
     )
-    endif(NOT BLAS95_LIBRARIES)
-  else(BLA_F95)
+    endif()
+  else()
     if(NOT BLAS_LIBRARIES)
     check_fortran_libraries(
     BLAS_LIBRARIES
@@ -322,9 +322,9 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
     "mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40"
     ""
     )
-    endif(NOT BLAS_LIBRARIES)
-  endif(BLA_F95)
-  else(WIN32)
+    endif()
+  endif()
+  else()
   if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
     if(BLA_F95)
       if(NOT BLAS95_LIBRARIES)
@@ -336,8 +336,8 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
       "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide"
       "${CMAKE_THREAD_LIBS_INIT};${LM}"
       )
-      endif(NOT BLAS95_LIBRARIES)
-    else(BLA_F95)
+      endif()
+    else()
     if(NOT BLAS_LIBRARIES)
       check_fortran_libraries(
       BLAS_LIBRARIES
@@ -348,9 +348,9 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
       "${CMAKE_THREAD_LIBS_INIT}"
       "${LM}"
       )
-      endif(NOT BLAS_LIBRARIES)
-    endif(BLA_F95)
-  endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+      endif()
+    endif()
+  endif ()
   if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
    if(BLA_F95)
     if(NOT BLAS95_LIBRARIES)
@@ -362,8 +362,8 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
       "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
       "${CMAKE_THREAD_LIBS_INIT};${LM}"
       )
-    endif(NOT BLAS95_LIBRARIES)
-   else(BLA_F95)
+    endif()
+   else()
      if(NOT BLAS_LIBRARIES)
       check_fortran_libraries(
       BLAS_LIBRARIES
@@ -373,10 +373,10 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
       "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
       "${CMAKE_THREAD_LIBS_INIT};${LM}"
       )
-     endif(NOT BLAS_LIBRARIES)
-   endif(BLA_F95)
-  endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
-  endif (WIN32)
+     endif()
+   endif()
+  endif ()
+  endif ()
   #older vesions of intel mkl libs
   # BLAS in intel mkl library? (shared)
   if(NOT BLAS_LIBRARIES)
@@ -388,7 +388,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
     "mkl;guide"
     "${CMAKE_THREAD_LIBS_INIT};${LM}"
     )
-  endif(NOT BLAS_LIBRARIES)
+  endif()
   #BLAS in intel mkl library? (static, 32bit)
   if(NOT BLAS_LIBRARIES)
     check_fortran_libraries(
@@ -399,7 +399,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
     "mkl_ia32;guide"
     "${CMAKE_THREAD_LIBS_INIT};${LM}"
     )
-  endif(NOT BLAS_LIBRARIES)
+  endif()
   #BLAS in intel mkl library? (static, em64t 64bit)
   if(NOT BLAS_LIBRARIES)
     check_fortran_libraries(
@@ -410,53 +410,53 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
     "mkl_em64t;guide"
     "${CMAKE_THREAD_LIBS_INIT};${LM}"
     )
-  endif(NOT BLAS_LIBRARIES)
- endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
-endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+  endif()
+ endif ()
+endif ()
 
 
 if(BLA_F95)
  if(BLAS95_LIBRARIES)
     set(BLAS95_FOUND TRUE)
-  else(BLAS95_LIBRARIES)
+  else()
     set(BLAS95_FOUND FALSE)
-  endif(BLAS95_LIBRARIES)
+  endif()
 
   if(NOT BLAS_FIND_QUIETLY)
     if(BLAS95_FOUND)
       message(STATUS "A library with BLAS95 API found.")
-    else(BLAS95_FOUND)
+    else()
       if(BLAS_FIND_REQUIRED)
         message(FATAL_ERROR
         "A required library with BLAS95 API not found. Please specify library location.")
-      else(BLAS_FIND_REQUIRED)
+      else()
         message(STATUS
         "A library with BLAS95 API not found. Please specify library location.")
-      endif(BLAS_FIND_REQUIRED)
-    endif(BLAS95_FOUND)
-  endif(NOT BLAS_FIND_QUIETLY)
+      endif()
+    endif()
+  endif()
   set(BLAS_FOUND TRUE)
   set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
-else(BLA_F95)
+else()
   if(BLAS_LIBRARIES)
     set(BLAS_FOUND TRUE)
-  else(BLAS_LIBRARIES)
+  else()
     set(BLAS_FOUND FALSE)
-  endif(BLAS_LIBRARIES)
+  endif()
 
   if(NOT BLAS_FIND_QUIETLY)
     if(BLAS_FOUND)
       message(STATUS "A library with BLAS API found.")
-    else(BLAS_FOUND)
+    else()
       if(BLAS_FIND_REQUIRED)
         message(FATAL_ERROR
         "A required library with BLAS API not found. Please specify library location."
         )
-      else(BLAS_FIND_REQUIRED)
+      else()
         message(STATUS
         "A library with BLAS API not found. Please specify library location."
         )
-      endif(BLAS_FIND_REQUIRED)
-    endif(BLAS_FOUND)
-  endif(NOT BLAS_FIND_QUIETLY)
-endif(BLA_F95)
+      endif()
+    endif()
+  endif()
+endif()
diff --git a/scripts/cmake/cmake/FindEigen3.cmake b/scripts/cmake/cmake/FindEigen3.cmake
index 22134ecd441..2b9e6afae4d 100644
--- a/scripts/cmake/cmake/FindEigen3.cmake
+++ b/scripts/cmake/cmake/FindEigen3.cmake
@@ -18,16 +18,16 @@
 if(NOT Eigen3_FIND_VERSION)
   if(NOT Eigen3_FIND_VERSION_MAJOR)
     set(Eigen3_FIND_VERSION_MAJOR 2)
-  endif(NOT Eigen3_FIND_VERSION_MAJOR)
+  endif()
   if(NOT Eigen3_FIND_VERSION_MINOR)
     set(Eigen3_FIND_VERSION_MINOR 91)
-  endif(NOT Eigen3_FIND_VERSION_MINOR)
+  endif()
   if(NOT Eigen3_FIND_VERSION_PATCH)
     set(Eigen3_FIND_VERSION_PATCH 0)
-  endif(NOT Eigen3_FIND_VERSION_PATCH)
+  endif()
 
   set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
-endif(NOT Eigen3_FIND_VERSION)
+endif()
 
 macro(_eigen3_check_version)
   file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
@@ -42,16 +42,16 @@ macro(_eigen3_check_version)
   set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
   if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
     set(EIGEN3_VERSION_OK FALSE)
-  else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+  else()
     set(EIGEN3_VERSION_OK TRUE)
-  endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+  endif()
 
   if(NOT EIGEN3_VERSION_OK)
 
     message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
                    "but at least version ${Eigen3_FIND_VERSION} is required")
-  endif(NOT EIGEN3_VERSION_OK)
-endmacro(_eigen3_check_version)
+  endif()
+endmacro()
 
 if (EIGEN3_INCLUDE_DIR)
 
@@ -59,7 +59,7 @@ if (EIGEN3_INCLUDE_DIR)
   _eigen3_check_version()
   set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
 
-else (EIGEN3_INCLUDE_DIR)
+else ()
 
   find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
       PATHS
@@ -76,12 +76,12 @@ else (EIGEN3_INCLUDE_DIR)
 
   if(EIGEN3_INCLUDE_DIR)
     _eigen3_check_version()
-  endif(EIGEN3_INCLUDE_DIR)
+  endif()
 
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
 
   mark_as_advanced(EIGEN3_INCLUDE_DIR)
 
-endif(EIGEN3_INCLUDE_DIR)
+endif()
 
diff --git a/scripts/cmake/cmake/FindLAPACK.cmake b/scripts/cmake/cmake/FindLAPACK.cmake
index 087ef8bcc1d..9fb8ae33422 100644
--- a/scripts/cmake/cmake/FindLAPACK.cmake
+++ b/scripts/cmake/cmake/FindLAPACK.cmake
@@ -39,9 +39,9 @@
 get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
 if (NOT _LANGUAGES_ MATCHES Fortran)
 include(CheckFunctionExists)
-else (NOT _LANGUAGES_ MATCHES Fortran)
+else ()
 include(CheckFortranFunctionExists)
-endif (NOT _LANGUAGES_ MATCHES Fortran)
+endif ()
 
 set(LAPACK_FOUND FALSE)
 set(LAPACK95_FOUND FALSE)
@@ -68,63 +68,63 @@ foreach(_library ${_list})
   if (WIN32)
     if(BLA_STATIC)
       set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
-    endif(BLA_STATIC)
+    endif()
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
     PATHS ENV LIB
     )
-  endif (WIN32)
+  endif ()
 
   if(APPLE)
     if(BLA_STATIC)
       set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so;.dylib")
-    endif(BLA_STATIC)
+    endif()
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
     PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
     )
-    else(APPLE)
+    else()
     if(BLA_STATIC)
      set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
-    endif(BLA_STATIC)
+    endif()
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
     PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
     )
-    endif(APPLE)
+    endif()
 
     mark_as_advanced(${_prefix}_${_library}_LIBRARY)
     set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
     set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
-  endif(_libraries_work)
-endforeach(_library ${_list})
+  endif()
+endforeach()
 
 if(_libraries_work)
   # Test this combination of libraries.
   if(UNIX AND BLA_STATIC)
     set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group ${${LIBRARIES}} ${_blas};-Wl,--end-group" ${_threads})
-  else(UNIX AND BLA_STATIC)
+  else()
     set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads})
-  endif(UNIX AND BLA_STATIC)
+  endif()
 #  message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
   if (NOT _LANGUAGES_ MATCHES Fortran)
     check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
-  else (NOT _LANGUAGES_ MATCHES Fortran)
+  else ()
     check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
-  endif (NOT _LANGUAGES_ MATCHES Fortran)
+  endif ()
   set(CMAKE_REQUIRED_LIBRARIES)
   mark_as_advanced(${_prefix}${_combined_name}_WORKS)
   set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
   #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
-endif(_libraries_work)
+endif()
 
  if(_libraries_work)
    set(${LIBRARIES} ${${LIBRARIES}} ${_blas})
- else(_libraries_work)
+ else()
     set(${LIBRARIES} FALSE)
- endif(_libraries_work)
+ endif()
 
-endmacro(Check_Lapack_Libraries)
+endmacro()
 
 
 set(LAPACK_LINKER_FLAGS)
@@ -149,11 +149,11 @@ if(BLAS_FOUND)
   set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
   if ($ENV{BLA_VENDOR} MATCHES ".+")
     set(BLA_VENDOR $ENV{BLA_VENDOR})
-  else ($ENV{BLA_VENDOR} MATCHES ".+")
+  else ()
     if(NOT BLA_VENDOR)
       set(BLA_VENDOR "All")
-    endif(NOT BLA_VENDOR)
-  endif ($ENV{BLA_VENDOR} MATCHES ".+")
+    endif()
+  endif ()
 #acml lapack
  if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
   if(NOT LAPACK_LIBRARIES)
@@ -166,7 +166,7 @@ if(BLAS_FOUND)
     ""
     ""
     )
-  endif(NOT LAPACK_LIBRARIES)
+  endif()
   if(NOT LAPACK_LIBRARIES)
    check_lapack_libraries(
     LAPACK_LIBRARIES
@@ -177,8 +177,8 @@ if(BLAS_FOUND)
     ""
     ""
     )
-  endif(NOT LAPACK_LIBRARIES)
- endif (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
+  endif()
+ endif ()
 
 # Apple LAPACK library?
 if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
@@ -192,8 +192,8 @@ if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
   "${BLAS_LIBRARIES}"
   ""
   )
- endif(NOT LAPACK_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
+ endif()
+endif ()
 if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
   if ( NOT LAPACK_LIBRARIES )
     check_lapack_libraries(
@@ -205,8 +205,8 @@ if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
     "${BLAS_LIBRARIES}"
     ""
     )
-  endif ( NOT LAPACK_LIBRARIES )
-endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
+  endif ()
+endif ()
 # Generic LAPACK library?
 if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
   if ( NOT LAPACK_LIBRARIES )
@@ -219,16 +219,16 @@ if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
     "${BLAS_LIBRARIES}"
     ""
     )
-  endif ( NOT LAPACK_LIBRARIES )
-endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
+  endif ()
+endif ()
 #intel lapack
  if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
   if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
    if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
       find_PACKAGE(Threads)
-   else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+   else()
        find_package(Threads REQUIRED)
-   endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+   endif()
    if (BLA_F95)
     if(NOT LAPACK95_LIBRARIES)
      check_lapack_libraries(
@@ -240,8 +240,8 @@ endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
      "${BLAS95_LIBRARIES}"
      "${CMAKE_THREAD_LIBS_INIT}"
      )
-    endif(NOT LAPACK95_LIBRARIES)
-   else(BLA_F95)
+    endif()
+   else()
     if(NOT LAPACK_LIBRARIES)
      check_lapack_libraries(
      LAPACK_LIBRARIES
@@ -252,57 +252,57 @@ endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
      "${BLAS_LIBRARIES}"
      "${CMAKE_THREAD_LIBS_INIT}"
      )
-    endif(NOT LAPACK_LIBRARIES)
-   endif(BLA_F95)
-  endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
- endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
-else(BLAS_FOUND)
+    endif()
+   endif()
+  endif ()
+ endif()
+else()
   message(STATUS "LAPACK requires BLAS")
-endif(BLAS_FOUND)
+endif()
 
 if(BLA_F95)
  if(LAPACK95_LIBRARIES)
   set(LAPACK95_FOUND TRUE)
- else(LAPACK95_LIBRARIES)
+ else()
   set(LAPACK95_FOUND FALSE)
- endif(LAPACK95_LIBRARIES)
+ endif()
  if(NOT LAPACK_FIND_QUIETLY)
   if(LAPACK95_FOUND)
     message(STATUS "A library with LAPACK95 API found.")
-  else(LAPACK95_FOUND)
+  else()
     if(LAPACK_FIND_REQUIRED)
       message(FATAL_ERROR
       "A required library with LAPACK95 API not found. Please specify library location."
       )
-    else(LAPACK_FIND_REQUIRED)
+    else()
       message(STATUS
       "A library with LAPACK95 API not found. Please specify library location."
       )
-    endif(LAPACK_FIND_REQUIRED)
-  endif(LAPACK95_FOUND)
- endif(NOT LAPACK_FIND_QUIETLY)
+    endif()
+  endif()
+ endif()
  set(LAPACK_FOUND "${LAPACK95_FOUND}")
  set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}")
-else(BLA_F95)
+else()
  if(LAPACK_LIBRARIES)
   set(LAPACK_FOUND TRUE)
- else(LAPACK_LIBRARIES)
+ else()
   set(LAPACK_FOUND FALSE)
- endif(LAPACK_LIBRARIES)
+ endif()
 
  if(NOT LAPACK_FIND_QUIETLY)
   if(LAPACK_FOUND)
     message(STATUS "A library with LAPACK API found.")
-  else(LAPACK_FOUND)
+  else()
     if(LAPACK_FIND_REQUIRED)
       message(FATAL_ERROR
       "A required library with LAPACK API not found. Please specify library location."
       )
-    else(LAPACK_FIND_REQUIRED)
+    else()
       message(STATUS
       "A library with LAPACK API not found. Please specify library location."
       )
-    endif(LAPACK_FIND_REQUIRED)
-  endif(LAPACK_FOUND)
- endif(NOT LAPACK_FIND_QUIETLY)
-endif(BLA_F95)
+    endif()
+  endif()
+ endif()
+endif()
diff --git a/scripts/cmake/cmake/FindMSVCRedist.cmake b/scripts/cmake/cmake/FindMSVCRedist.cmake
index f33e03003c4..4331268e9a1 100644
--- a/scripts/cmake/cmake/FindMSVCRedist.cmake
+++ b/scripts/cmake/cmake/FindMSVCRedist.cmake
@@ -17,9 +17,9 @@ if (MSVC)
     #  # VS 9 and earlier:
     #  set(CMAKE_MSVC_ARCH amd64)
     #endif()
-  else(CMAKE_CL_64)
+  else()
     set(CMAKE_MSVC_ARCH x86)
-  endif(CMAKE_CL_64)
+  endif()
   
   set(SDKVERS "2.0")
   if(${VCVERS} EQUAL 8)
@@ -44,5 +44,5 @@ vcredist_${CMAKE_MSVC_ARCH}/vcredist_${CMAKE_MSVC_ARCH}.exe
     install(PROGRAMS ${MSVC_REDIST} COMPONENT msvc_redist DESTINATION bin)
     set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\bin\\\\${vcredist_name}\\\"'")
     message(STATUS "MSVC_REDIST: ${MSVC_REDIST}")
-  endif(MSVC${VCVERS}0 OR MSVC${VCVERS})
+  endif()
 endif ()
\ No newline at end of file
diff --git a/scripts/cmake/cmake/FindMsysGit.cmake b/scripts/cmake/cmake/FindMsysGit.cmake
index dc5c1b88e0a..1e4f545d98e 100644
--- a/scripts/cmake/cmake/FindMsysGit.cmake
+++ b/scripts/cmake/cmake/FindMsysGit.cmake
@@ -21,7 +21,7 @@ if(GIT_EXECUTABLE)
     endif()
   endif()
   unset(git_version)
-endif(GIT_EXECUTABLE)
+endif()
 
 if(GIT_IS_MSYSGIT)
   get_filename_component(MSYS_DIR ${GIT_EXECUTABLE} PATH)
diff --git a/scripts/cmake/cmake/FindNetCDF.cmake b/scripts/cmake/cmake/FindNetCDF.cmake
index 6f40c7e5047..6a8d2361cee 100644
--- a/scripts/cmake/cmake/FindNetCDF.cmake
+++ b/scripts/cmake/cmake/FindNetCDF.cmake
@@ -28,7 +28,7 @@
 if (NETCDF_INCLUDES AND NETCDF_LIBRARIES)
   # Already in cache, be silent
   set (NETCDF_FIND_QUIETLY TRUE)
-endif (NETCDF_INCLUDES AND NETCDF_LIBRARIES)
+endif ()
 
 find_path (NETCDF_INCLUDES netcdf.h
   HINTS NETCDF_DIR ENV NETCDF_DIR)
@@ -50,12 +50,12 @@ macro (NetCDF_check_interface lang header libs)
     mark_as_advanced (NETCDF_INCLUDES_${lang} NETCDF_LIBRARIES_${lang})
     if (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang})
       list (INSERT NetCDF_libs 0 ${NETCDF_LIBRARIES_${lang}}) # prepend so that -lnetcdf is last
-    else (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang})
+    else ()
       set (NetCDF_has_interfaces "NO")
       message (STATUS "Failed to find NetCDF interface for ${lang}")
-    endif (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang})
-  endif (NETCDF_${lang})
-endmacro (NetCDF_check_interface)
+    endif ()
+  endif ()
+endmacro ()
 
 NetCDF_check_interface (CXX netcdfcpp.h netcdf_c++)
 NetCDF_check_interface (F77 netcdf.inc  netcdff)
diff --git a/scripts/cmake/cmake/FindOpenSGSupportlibs.cmake b/scripts/cmake/cmake/FindOpenSGSupportlibs.cmake
index a1a6ee697f6..ce56d522d99 100644
--- a/scripts/cmake/cmake/FindOpenSGSupportlibs.cmake
+++ b/scripts/cmake/cmake/FindOpenSGSupportlibs.cmake
@@ -21,7 +21,7 @@ if (NOT OpenSGSupportlibs_FOUND)
 		NAMES glut32 libjpg libpng tif32 zlib
 		PATHS ${LIBRARIES_DIR}/supportlibs/lib
 		  ${CMAKE_SOURCE_DIR}/../supportlibs/lib )  
-	else (VS32)  
+	else ()  
 	  if (VS64) 
 	    # Visual Studio x64
 		find_path( OpenSGSupportlibs_INCLUDE_DIR
@@ -33,8 +33,8 @@ if (NOT OpenSGSupportlibs_FOUND)
 		NAMES glut32 libjpg libpng tif32 zlib
 		PATHS ${LIBRARIES_DIR}/supportlibs_x64/lib
 		  ${CMAKE_SOURCE_DIR}/../supportlibs_x64/lib )
-	  endif(VS64)
-	endif (VS32)
+	  endif()
+	endif ()
 
 	# Set the include dir variables and the libraries and let libfind_process do the rest.
 	# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
@@ -42,4 +42,4 @@ if (NOT OpenSGSupportlibs_FOUND)
 	set(OpenSGSupportlibs_PROCESS_LIBS OpenSGSupportlibs_LIBRARY)
 	libfind_process(OpenSGSupportlibs)
 	
-endif (NOT OpenSGSupportlibs_FOUND)
\ No newline at end of file
+endif ()
\ No newline at end of file
diff --git a/scripts/cmake/cmake/FindQVTK.cmake b/scripts/cmake/cmake/FindQVTK.cmake
index b50f40055f5..51d363ae4bc 100644
--- a/scripts/cmake/cmake/FindQVTK.cmake
+++ b/scripts/cmake/cmake/FindQVTK.cmake
@@ -19,9 +19,9 @@ find_package_handle_standard_args(QVTK DEFAULT_MSG
 
 if(NOT QVTK_FOUND)
   set (VTK_USE_QVTK OFF)
-else(NOT QVTK_FOUND)
+else()
   get_filename_component (QVTK_LIBRARY_DIR ${QVTK_LIBRARY} PATH)
   set (VTK_LIBRARY_DIRS ${VTK_LIBRARY_DIRS} ${QVTK_LIBRARY_DIR})
   set (VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${QVTK_INCLUDE_DIR})
   set (VTK_USE_QVTK ON)
-endif(NOT QVTK_FOUND)
+endif()
diff --git a/scripts/cmake/cmake/LibFindMacros.cmake b/scripts/cmake/cmake/LibFindMacros.cmake
index f3d501a2107..deba5d29390 100644
--- a/scripts/cmake/cmake/LibFindMacros.cmake
+++ b/scripts/cmake/cmake/LibFindMacros.cmake
@@ -6,12 +6,12 @@ macro (libfind_package PREFIX)
   set (LIBFIND_PACKAGE_ARGS ${ARGN})
   if (${PREFIX}_FIND_QUIETLY)
     set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET)
-  endif (${PREFIX}_FIND_QUIETLY)
+  endif ()
   if (${PREFIX}_FIND_REQUIRED)
     set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED)
-  endif (${PREFIX}_FIND_REQUIRED)
+  endif ()
   find_package(${LIBFIND_PACKAGE_ARGS})
-endmacro (libfind_package)
+endmacro ()
 
 # Damn CMake developers made the UsePkgConfig system deprecated in the same release (2.6)
 # where they added pkg_check_modules. Consequently I need to support both in my scripts
@@ -21,13 +21,13 @@ macro (libfind_pkg_check_modules PREFIX PKGNAME)
   if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
     include(UsePkgConfig)
     pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS)
-  else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+  else ()
     find_package(PkgConfig)
     if (PKG_CONFIG_FOUND)
       pkg_check_modules(${PREFIX} ${PKGNAME})
-    endif (PKG_CONFIG_FOUND)
-  endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
-endmacro (libfind_pkg_check_modules)
+    endif ()
+  endif ()
+endmacro ()
 
 # Do the final processing once the paths have been detected.
 # If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
@@ -46,56 +46,56 @@ macro (libfind_process PREFIX)
       if (${i})
         set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
         mark_as_advanced(${i})
-      else (${i})
+      else ()
         set (${PREFIX}_FOUND FALSE)
-      endif (${i})
-    endforeach (i)
+      endif ()
+    endforeach ()
 
     # Process all libraries and set _FOUND to false if any are missing
     foreach (i ${${PREFIX}_PROCESS_LIBS})
       if (${i})
         set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
         mark_as_advanced(${i})
-      else (${i})
+      else ()
         set (${PREFIX}_FOUND FALSE)
-      endif (${i})
-    endforeach (i)
+      endif ()
+    endforeach ()
 
     # Print message and/or exit on fatal error
     if (${PREFIX}_FOUND)
       if (NOT ${PREFIX}_FIND_QUIETLY)
         message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
-      endif (NOT ${PREFIX}_FIND_QUIETLY)
-    else (${PREFIX}_FOUND)
+      endif ()
+    else ()
       if (${PREFIX}_FIND_REQUIRED)
         foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
           message("${i}=${${i}}")
-        endforeach (i)
+        endforeach ()
         message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
-      endif (${PREFIX}_FIND_REQUIRED)
-    endif (${PREFIX}_FOUND)
-  endif (NOT ${PREFIX}_FOUND)
+      endif ()
+    endif ()
+  endif ()
 
   # Cache libraries variable
   set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} CACHE STRING "${PREFIX} libraries")
-endmacro (libfind_process)
+endmacro ()
 
 macro(libfind_library PREFIX basename)
   set(TMP "")
   if(MSVC80)
     set(TMP -vc80)
-  endif(MSVC80)
+  endif()
   if(MSVC90)
     set(TMP -vc90)
-  endif(MSVC90)
+  endif()
   set(${PREFIX}_LIBNAMES ${basename}${TMP})
   if(${ARGC} GREATER 2)
     set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2})
     string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES})
     set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP})
-  endif(${ARGC} GREATER 2)
+  endif()
   find_library(${PREFIX}_LIBRARY
     NAMES ${${PREFIX}_LIBNAMES}
     PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}
   )
-endmacro(libfind_library)
+endmacro()
diff --git a/scripts/cmake/cmake/ListAllCMakeVariableValues.cmake b/scripts/cmake/cmake/ListAllCMakeVariableValues.cmake
index 9e3c66765c3..c7ee7dbce38 100644
--- a/scripts/cmake/cmake/ListAllCMakeVariableValues.cmake
+++ b/scripts/cmake/cmake/ListAllCMakeVariableValues.cmake
@@ -10,6 +10,6 @@ function(list_all_cmake_variable_values)
   get_cmake_property(vs VARIABLES)
   foreach(v ${vs})
     message(STATUS "${v}='${${v}}'")
-  endforeach(v)
+  endforeach()
   message(STATUS "")
 endfunction()
diff --git a/scripts/cmake/cmake/cmake-2.8.0-modules/features/SelectLibraryConfigurations.cmake b/scripts/cmake/cmake/cmake-2.8.0-modules/features/SelectLibraryConfigurations.cmake
index ee1220ccda7..c6c4067f985 100644
--- a/scripts/cmake/cmake/cmake-2.8.0-modules/features/SelectLibraryConfigurations.cmake
+++ b/scripts/cmake/cmake/cmake-2.8.0-modules/features/SelectLibraryConfigurations.cmake
@@ -65,8 +65,8 @@ macro( _set_library_name basename GOOD BAD )
         set( ${basename}_LIBRARY_${BAD} ${${basename}_LIBRARY_${GOOD}} )
         set( ${basename}_LIBRARY ${${basename}_LIBRARY_${GOOD}} )
         set( ${basename}_LIBRARIES ${${basename}_LIBRARY_${GOOD}} )
-    endif( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} )
-endmacro( _set_library_name )
+    endif()
+endmacro()
 
 macro( select_library_configurations basename )
     # if only the release version was found, set the debug to be the release
@@ -85,24 +85,24 @@ macro( select_library_configurations basename )
             set( ${basename}_LIBRARIES 
                 optimized ${${basename}_LIBRARY_RELEASE}
                 debug ${${basename}_LIBRARY_DEBUG} )
-        else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+        else()
             # If there are no configuration types or build type, just use
             # the release version
             set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
             set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} )
-        endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
-    endif( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE )
+        endif()
+    endif()
 
     set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH 
         "The ${basename} library" )
 
     if( ${basename}_LIBRARY )
         set( ${basename}_FOUND TRUE )
-    endif( ${basename}_LIBRARY )
+    endif()
 
     mark_as_advanced( ${basename}_LIBRARY 
         ${basename}_LIBRARY_RELEASE
         ${basename}_LIBRARY_DEBUG
     )
-endmacro( select_library_configurations )
+endmacro()
 
diff --git a/scripts/cmake/cmake/cmake-2.8.4-modules/boost/FindBoost.cmake b/scripts/cmake/cmake/cmake-2.8.4-modules/boost/FindBoost.cmake
index 61ec7d11105..f544814bb95 100644
--- a/scripts/cmake/cmake/cmake-2.8.4-modules/boost/FindBoost.cmake
+++ b/scripts/cmake/cmake/cmake-2.8.4-modules/boost/FindBoost.cmake
@@ -321,16 +321,16 @@ macro (_Boost_ADJUST_LIB_VARS basename)
 
       set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
       set(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
-    endif(Boost_${basename}_LIBRARY)
+    endif()
 
-  endif (Boost_INCLUDE_DIR )
+  endif ()
   # Make variables changeble to the advanced user
   mark_as_advanced(
       Boost_${basename}_LIBRARY
       Boost_${basename}_LIBRARY_RELEASE
       Boost_${basename}_LIBRARY_DEBUG
   )
-endmacro (_Boost_ADJUST_LIB_VARS)
+endmacro ()
 
 #-------------------------------------------------------------------------------
 
@@ -401,7 +401,7 @@ if(Boost_FIND_VERSION_EXACT)
   set(_boost_TEST_VERSIONS
     "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
     "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
-else(Boost_FIND_VERSION_EXACT)
+else()
   # The user has not requested an exact version.  Among known
   # versions, find those that are acceptable to the user request.
   set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
@@ -422,12 +422,12 @@ else(Boost_FIND_VERSION_EXACT)
         # the patch level dropped.
         list(APPEND _boost_TEST_VERSIONS "${version}")
       endif()
-    endforeach(version)
-  else(Boost_FIND_VERSION)
+    endforeach()
+  else()
     # Any version is acceptable.
     set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
-  endif(Boost_FIND_VERSION)
-endif(Boost_FIND_VERSION_EXACT)
+  endif()
+endif()
 
 # The reason that we failed to find Boost. This will be set to a
 # user-friendly message when we fail to find some necessary piece of
@@ -449,11 +449,11 @@ if(Boost_INCLUDE_DIR)
     string(TOUPPER ${COMPONENT} COMPONENT)
     if(NOT Boost_${COMPONENT}_FOUND)
       set( _boost_IN_CACHE FALSE)
-    endif(NOT Boost_${COMPONENT}_FOUND)
-  endforeach(COMPONENT)
-else(Boost_INCLUDE_DIR)
+    endif()
+  endforeach()
+else()
   set( _boost_IN_CACHE FALSE)
-endif(Boost_INCLUDE_DIR)
+endif()
 
 if (_boost_IN_CACHE)
   # in cache already
@@ -462,19 +462,19 @@ if (_boost_IN_CACHE)
     string(TOUPPER ${COMPONENT} COMPONENT)
     _Boost_ADJUST_LIB_VARS( ${COMPONENT} )
     set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY})
-  endforeach(COMPONENT)
+  endforeach()
   set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
   if(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
     math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
     math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
     math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
-  endif(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
+  endif()
   if(Boost_DEBUG)
       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
                      "boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} "
                      "is already in the cache.  To view debugging messages, please clear the cache.")
   endif()
-else (_boost_IN_CACHE)
+else ()
   # Need to search for boost
   if(Boost_DEBUG)
     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
@@ -514,7 +514,7 @@ else (_boost_IN_CACHE)
     # for linking.
     set(Boost_LIB_DIAGNOSTIC_DEFINITIONS
       "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
-  endif(WIN32)
+  endif()
 
   set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM
     C:/boost/include
@@ -534,26 +534,26 @@ else (_boost_IN_CACHE)
   # If BOOST_ROOT was defined in the environment, use it.
   if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
     set(BOOST_ROOT $ENV{BOOST_ROOT})
-  endif(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
+  endif()
 
   # If BOOSTROOT was defined in the environment, use it.
   if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
     set(BOOST_ROOT $ENV{BOOSTROOT})
-  endif(NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
+  endif()
 
   # If BOOST_INCLUDEDIR was defined in the environment, use it.
   if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
     set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
-  endif( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
+  endif()
 
   # If BOOST_LIBRARYDIR was defined in the environment, use it.
   if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
     set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
-  endif( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
+  endif()
 
   if( BOOST_ROOT )
     file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
-  endif( BOOST_ROOT )
+  endif()
 
   if(Boost_DEBUG)
     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
@@ -586,7 +586,7 @@ else (_boost_IN_CACHE)
     file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
     set(_boost_INCLUDE_SEARCH_DIRS
       ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
-  endif( BOOST_INCLUDEDIR )
+  endif()
 
   # ------------------------------------------------------------------------
   #  Search for Boost include DIR
@@ -614,7 +614,7 @@ else (_boost_IN_CACHE)
       list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
       list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
 
-    endforeach(_boost_VER)
+    endforeach()
 
     if(Boost_DEBUG)
       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
@@ -632,7 +632,7 @@ else (_boost_IN_CACHE)
       PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
       ${_boost_FIND_OPTIONS}
       )
-  endif( NOT Boost_INCLUDE_DIR )
+  endif()
 
   # ------------------------------------------------------------------------
   #  Extract version information from version.hpp
@@ -663,16 +663,16 @@ else (_boost_IN_CACHE)
 
       set(Boost_ERROR_REASON
           "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
-    endif(NOT "${Boost_VERSION}" STREQUAL "0")
+    endif()
     if(Boost_DEBUG)
       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
                      "version.hpp reveals boost "
                      "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
     endif()
-  else(Boost_INCLUDE_DIR)
+  else()
     set(Boost_ERROR_REASON
       "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
-  endif(Boost_INCLUDE_DIR)
+  endif()
 
   # ------------------------------------------------------------------------
   #  Suffix initialization and compiler suffix detection.
@@ -690,7 +690,7 @@ else (_boost_IN_CACHE)
       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
                      "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
     endif()
-  else(Boost_COMPILER)
+  else()
     # Attempt to guess the compiler suffix
     # NOTE: this is not perfect yet, if you experience any issues
     # please report them and use the Boost_COMPILER variable
@@ -739,27 +739,27 @@ else (_boost_IN_CACHE)
                 # In Boost 1.36.0 and newer, the mangled compiler name used
                 # on Mac OS X/Darwin is "xgcc".
                 set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
-              else(${Boost_MINOR_VERSION} GREATER 35)
+              else()
                 # In Boost <= 1.35.0, there is no mangled compiler name for
                 # the Mac OS X/Darwin version of GCC.
                 set(_boost_COMPILER "")
-              endif(${Boost_MINOR_VERSION} GREATER 35)
-            else(Boost_MINOR_VERSION)
+              endif()
+            else()
               # We don't know the Boost version, so assume it's
               # pre-1.36.0.
               set(_boost_COMPILER "")
-            endif(Boost_MINOR_VERSION)
+            endif()
           else()
             set (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
           endif()
         endif()
-      endif (CMAKE_COMPILER_IS_GNUCXX)
+      endif ()
     endif()
     if(Boost_DEBUG)
       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
         "guessed _boost_COMPILER = ${_boost_COMPILER}")
     endif()
-  endif(Boost_COMPILER)
+  endif()
 
   set (_boost_MULTITHREADED "-mt")
   if( NOT Boost_USE_MULTITHREADED )
@@ -974,7 +974,7 @@ else (_boost_IN_CACHE)
 
     _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
 
-  endforeach(COMPONENT)
+  endforeach()
 
   # Restore the original find library ordering
   if( Boost_USE_STATIC_LIBS )
@@ -995,7 +995,7 @@ else (_boost_IN_CACHE)
     # Check the version of Boost against the requested version.
     if (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
       message(SEND_ERROR "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34")
-    endif (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
+    endif ()
     if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
       set( Boost_FOUND FALSE )
       set(_Boost_VERSION_AGE "old")
@@ -1007,9 +1007,9 @@ else (_boost_IN_CACHE)
         if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
           set( Boost_FOUND FALSE )
           set(_Boost_VERSION_AGE "old")
-        endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
-      endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
-    endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
+        endif()
+      endif()
+    endif()
 
     if (NOT Boost_FOUND)
       _Boost_MARK_COMPONENTS_FOUND(OFF)
@@ -1024,7 +1024,7 @@ else (_boost_IN_CACHE)
       # If the user didn't specify a patchlevel, it's 0.
       if (NOT Boost_FIND_VERSION_PATCH)
         set(Boost_FIND_VERSION_PATCH 0)
-      endif (NOT Boost_FIND_VERSION_PATCH)
+      endif ()
 
       # We'll set Boost_FOUND true again if we have an exact version match.
       set(Boost_FOUND FALSE)
@@ -1034,10 +1034,10 @@ else (_boost_IN_CACHE)
           if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
             set( Boost_FOUND TRUE )
             _Boost_MARK_COMPONENTS_FOUND(ON)
-          endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
-        endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
-      endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
-    endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
+          endif()
+        endif()
+      endif()
+    endif ()
 
     if(NOT Boost_FOUND)
       # State that we found a version of Boost that is too new or too old.
@@ -1046,12 +1046,12 @@ else (_boost_IN_CACHE)
       if (Boost_FIND_VERSION_PATCH)
         set(Boost_ERROR_REASON
           "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
-      endif (Boost_FIND_VERSION_PATCH)
+      endif ()
       if (NOT Boost_FIND_VERSION_EXACT)
         set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
-      endif (NOT Boost_FIND_VERSION_EXACT)
+      endif ()
       set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
-    endif (NOT Boost_FOUND)
+    endif ()
 
     # Always check for missing components
     set(_boost_CHECKED_COMPONENT FALSE)
@@ -1063,8 +1063,8 @@ else (_boost_IN_CACHE)
         string(TOLOWER ${COMPONENT} COMPONENT)
         list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
         set( Boost_FOUND FALSE)
-      endif(NOT Boost_${COMPONENT}_FOUND)
-    endforeach(COMPONENT)
+      endif()
+    endforeach()
 
     if(Boost_DEBUG)
       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
@@ -1078,18 +1078,18 @@ else (_boost_IN_CACHE)
       foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
         set(Boost_ERROR_REASON
           "${Boost_ERROR_REASON}        boost_${COMPONENT}\n")
-      endforeach(COMPONENT)
+      endforeach()
 
       list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
       list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
       if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
         set(Boost_ERROR_REASON
           "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
-      else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
+      else ()
         set(Boost_ERROR_REASON
           "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
-      endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
-    endif (_Boost_MISSING_COMPONENTS)
+      endif ()
+    endif ()
 
     if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
       # Compatibility Code for backwards compatibility with CMake
@@ -1102,32 +1102,32 @@ else (_boost_IN_CACHE)
 
       if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
         get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
-      endif ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
+      endif ()
 
       if("${_boost_LIB_DIR}" MATCHES "/include$")
         # Strip off the trailing "/include" in the path.
         get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
-      endif("${_boost_LIB_DIR}" MATCHES "/include$")
+      endif()
 
       if(EXISTS "${_boost_LIB_DIR}/lib")
         set (_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
-      else(EXISTS "${_boost_LIB_DIR}/lib")
+      else()
         if(EXISTS "${_boost_LIB_DIR}/stage/lib")
           set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
-        else(EXISTS "${_boost_LIB_DIR}/stage/lib")
+        else()
           set(_boost_LIB_DIR "")
-        endif(EXISTS "${_boost_LIB_DIR}/stage/lib")
-      endif(EXISTS "${_boost_LIB_DIR}/lib")
+        endif()
+      endif()
 
       if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
         set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
-      endif(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
+      endif()
 
-    endif( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
+    endif()
 
-  else(Boost_INCLUDE_DIR)
+  else()
     set( Boost_FOUND FALSE)
-  endif(Boost_INCLUDE_DIR)
+  endif()
 
   if (Boost_FOUND)
       if (NOT Boost_FIND_QUIETLY)
@@ -1135,16 +1135,16 @@ else (_boost_IN_CACHE)
         if(Boost_FIND_COMPONENTS)
           message(STATUS "Found the following Boost libraries:")
         endif()
-      endif(NOT Boost_FIND_QUIETLY)
+      endif()
       foreach ( COMPONENT  ${Boost_FIND_COMPONENTS} )
         string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
         if ( Boost_${UPPERCOMPONENT}_FOUND )
           if (NOT Boost_FIND_QUIETLY)
             message (STATUS "  ${COMPONENT}")
-          endif(NOT Boost_FIND_QUIETLY)
+          endif()
           set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
-        endif ( Boost_${UPPERCOMPONENT}_FOUND )
-      endforeach(COMPONENT)
+        endif ()
+      endforeach()
   else()
     if(Boost_FIND_REQUIRED)
       message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
@@ -1160,7 +1160,7 @@ else (_boost_IN_CACHE)
           message(STATUS "Could NOT find Boost")
         endif()
       endif()
-    endif(Boost_FIND_REQUIRED)
+    endif()
   endif()
 
   # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view
@@ -1168,4 +1168,4 @@ else (_boost_IN_CACHE)
       Boost_INCLUDE_DIRS
       Boost_LIBRARY_DIRS
   )
-endif(_boost_IN_CACHE)
+endif()
diff --git a/scripts/cmake/findPETSC/CorrectWindowsPaths.cmake b/scripts/cmake/findPETSC/CorrectWindowsPaths.cmake
index ab17bb28bc3..671d1d97405 100644
--- a/scripts/cmake/findPETSC/CorrectWindowsPaths.cmake
+++ b/scripts/cmake/findPETSC/CorrectWindowsPaths.cmake
@@ -9,5 +9,5 @@ macro (CONVERT_CYGWIN_PATH _path)
     execute_process(COMMAND cygpath.exe -m ${${_path}}
       OUTPUT_VARIABLE ${_path})
     string (STRIP ${${_path}} ${_path})
-  endif (WIN32)
-endmacro (CONVERT_CYGWIN_PATH)
+  endif ()
+endmacro ()
diff --git a/scripts/cmake/findPETSC/FindPETSc.cmake b/scripts/cmake/findPETSC/FindPETSc.cmake
index 536e4546cc6..cfe6c832eb0 100644
--- a/scripts/cmake/findPETSC/FindPETSc.cmake
+++ b/scripts/cmake/findPETSC/FindPETSc.cmake
@@ -94,11 +94,11 @@ if (PETSC_DIR AND NOT PETSC_ARCH)
   NO_DEFAULT_PATH)
       if (petscconf)
   set (PETSC_ARCH "${arch}" CACHE STRING "PETSc build architecture")
-      endif (petscconf)
-    endif (NOT PETSC_ARCH)
-  endforeach (arch)
+      endif ()
+    endif ()
+  endforeach ()
   set (petscconf "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE)
-endif (PETSC_DIR AND NOT PETSC_ARCH)
+endif ()
 
 set (petsc_slaves LIBRARIES_SYS LIBRARIES_VEC LIBRARIES_MAT LIBRARIES_DM LIBRARIES_KSP LIBRARIES_SNES LIBRARIES_TS
   INCLUDE_DIR INCLUDE_CONF)
@@ -147,7 +147,7 @@ show :
     execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name}
       OUTPUT_VARIABLE ${var}
       RESULT_VARIABLE petsc_return)
-  endmacro (PETSC_GET_VARIABLE)
+  endmacro ()
   petsc_get_variable (PETSC_LIB_DIR            petsc_lib_dir)
   petsc_get_variable (PETSC_EXTERNAL_LIB_BASIC petsc_libs_external)
   petsc_get_variable (PETSC_CCPPFLAGS          petsc_cpp_line)
@@ -174,14 +174,14 @@ show :
           CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
         if(${flag_var} MATCHES "/MD")
           set(using_md True)
-        endif(${flag_var} MATCHES "/MD")
-      endforeach(flag_var)
+        endif()
+      endforeach()
       if(${using_md} MATCHES "True")
         message(WARNING "PETSc was built with /MT, but /MD is currently set.
  See http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F")
-      endif(${using_md} MATCHES "True")
-    endif (petsc_cc_flags MATCHES "-MT")
-  endif (WIN32)
+      endif()
+    endif ()
+  endif ()
 
   include (CorrectWindowsPaths)
   convert_cygwin_path(petsc_lib_dir)
@@ -191,13 +191,13 @@ show :
     set (PETSC_LIBRARY_${suffix} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # Clear any stale value, if we got here, we need to find it again
     if (WIN32)
       set (libname lib${name}) #windows expects "libfoo", linux expects "foo"
-    else (WIN32)
+    else ()
       set (libname ${name})
-    endif (WIN32)
+    endif ()
     find_library (PETSC_LIBRARY_${suffix} NAMES ${libname} HINTS ${petsc_lib_dir} NO_DEFAULT_PATH)
     set (PETSC_LIBRARIES_${suffix} "${PETSC_LIBRARY_${suffix}}")
     mark_as_advanced (PETSC_LIBRARY_${suffix})
-  endmacro (PETSC_FIND_LIBRARY suffix name)
+  endmacro ()
 
   # Look for petscvec first, if it doesn't exist, we must be using single-library
   petsc_find_library (VEC petscvec)
@@ -210,7 +210,7 @@ show :
     petsc_find_library (TS   petscts)
     macro (PETSC_JOIN libs deps)
       list (APPEND PETSC_LIBRARIES_${libs} ${PETSC_LIBRARIES_${deps}})
-    endmacro (PETSC_JOIN libs deps)
+    endmacro ()
     petsc_join (VEC  SYS)
     petsc_join (MAT  VEC)
     petsc_join (DM   MAT)
@@ -263,8 +263,8 @@ int main(int argc,char *argv[]) {
     if (${${runs}})
       set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL
   "Can the system successfully run a PETSc executable?  This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build.  If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE)
-    endif (${${runs}})
-  endmacro (PETSC_TEST_RUNS)
+    endif ()
+  endmacro ()
 
 
   find_path (PETSC_INCLUDE_DIR petscts.h HINTS "${PETSC_DIR}" PATH_SUFFIXES include NO_DEFAULT_PATH)
@@ -276,32 +276,32 @@ int main(int argc,char *argv[]) {
   if (petsc_works_minimal)
     message (STATUS "Minimal PETSc includes and libraries work.  This probably means we are building with shared libs.")
     set (petsc_includes_needed "${petsc_includes_minimal}")
-  else (petsc_works_minimal)  # Minimal includes fail, see if just adding full includes fixes it
+  else ()  # Minimal includes fail, see if just adding full includes fixes it
     petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_allincludes)
     if (petsc_works_allincludes) # It does, we just need all the includes (
       message (STATUS "PETSc requires extra include paths, but links correctly with only interface libraries.  This is an unexpected configuration (but it seems to work fine).")
       set (petsc_includes_needed ${petsc_includes_all})
-    else (petsc_works_allincludes) # We are going to need to link the external libs explicitly
+    else () # We are going to need to link the external libs explicitly
       resolve_libraries (petsc_libraries_external "${petsc_libs_external}")
       foreach (pkg SYS VEC MAT DM KSP SNES TS ALL)
   list (APPEND PETSC_LIBRARIES_${pkg}  ${petsc_libraries_external})
-      endforeach (pkg)
+      endforeach ()
       petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_alllibraries)
       if (petsc_works_alllibraries)
    message (STATUS "PETSc only need minimal includes, but requires explicit linking to all dependencies.  This is expected when PETSc is built with static libraries.")
   set (petsc_includes_needed ${petsc_includes_minimal})
-      else (petsc_works_alllibraries)
+      else ()
   # It looks like we really need everything, should have listened to Matt
   set (petsc_includes_needed ${petsc_includes_all})
   petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_all)
   if (petsc_works_all) # We fail anyways
     message (STATUS "PETSc requires extra include paths and explicit linking to all dependencies.  This probably means you have static libraries and something unexpected in PETSc headers.")
-  else (petsc_works_all) # We fail anyways
+  else () # We fail anyways
     message (STATUS "PETSc could not be used, maybe the install is broken.")
-  endif (petsc_works_all)
-      endif (petsc_works_alllibraries)
-    endif (petsc_works_allincludes)
-  endif (petsc_works_minimal)
+  endif ()
+      endif ()
+    endif ()
+  endif ()
 
   # We do an out-of-source build so __FILE__ will be an absolute path, hence __INSDIR__ is superfluous
   if (${PETSC_VERSION} VERSION_LESS 3.1)
diff --git a/scripts/cmake/findPETSC/FindPackageMultipass.cmake b/scripts/cmake/findPETSC/FindPackageMultipass.cmake
index 8c023787c8d..7e681ca8236 100644
--- a/scripts/cmake/findPETSC/FindPackageMultipass.cmake
+++ b/scripts/cmake/findPETSC/FindPackageMultipass.cmake
@@ -19,7 +19,7 @@
 #      DEPENDENTS INCLUDES LIBRARIES)
 #    if (NOT foo_current)
 #      # Make temporary files, run programs, etc, to determine FOO_INCLUDES and FOO_LIBRARIES
-#    endif (NOT foo_current)
+#    endif ()
 #
 # MULTIPASS_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS LANGUAGE)
 #  Always runs the given test, use this when you need to re-run tests
@@ -47,18 +47,18 @@ macro (FIND_PACKAGE_MULTIPASS _name _current)
       set (_stored_var PACKAGE_MULTIPASS_${_NAME}_${_state})
       if (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}")
   set (_states_current "NO")
-      endif (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}")
+      endif ()
       set (${_stored_var} "${${_NAME}_${_state}}" CACHE INTERNAL "Stored state for ${_name}." FORCE)
       list (REMOVE_AT _args 0)
       list (GET _args 0 _state)
-    endwhile (_state AND NOT _state STREQUAL "DEPENDENTS")
-  endif (_cmd STREQUAL "STATES")
+    endwhile ()
+  endif ()
 
   set (_stored ${_NAME}_CURRENT)
   if (NOT ${_stored})
     set (${_stored} "YES" CACHE BOOL "Is the configuration for ${_name} current?  Set to \"NO\" to reconfigure." FORCE)
     set (_states_current "NO")
-  endif (NOT ${_stored})
+  endif ()
 
   set (${_current} ${_states_current})
   if (NOT ${_current} AND PACKAGE_MULTIPASS_${_name}_CALLED)
@@ -69,12 +69,12 @@ macro (FIND_PACKAGE_MULTIPASS _name _current)
       list (REMOVE_AT _args 0)
       foreach (dep ${_args})
   set (${_NAME}_${dep} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
-      endforeach (dep)
-    endif (_cmd STREQUAL "DEPENDENTS")
+      endforeach ()
+    endif ()
     set (${_NAME}_FOUND "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
   endif ()
   set (PACKAGE_MULTIPASS_${name}_CALLED YES CACHE INTERNAL "Private" FORCE)
-endmacro (FIND_PACKAGE_MULTIPASS)
+endmacro ()
 
 
 macro (MULTIPASS_SOURCE_RUNS includes libraries source runs language)
@@ -87,7 +87,7 @@ macro (MULTIPASS_SOURCE_RUNS includes libraries source runs language)
   # test *needs* to be rerun.
   if (NOT MULTIPASS_TEST_COUNT)
     set (MULTIPASS_TEST_COUNT 00)
-  endif (NOT MULTIPASS_TEST_COUNT)
+  endif ()
   math (EXPR _tmp "${MULTIPASS_TEST_COUNT} + 1") # Why can't I add to a cache variable?
   set (MULTIPASS_TEST_COUNT ${_tmp} CACHE INTERNAL "Unique test ID")
   set (testname MULTIPASS_TEST_${MULTIPASS_TEST_COUNT}_${runs})
@@ -99,8 +99,8 @@ macro (MULTIPASS_SOURCE_RUNS includes libraries source runs language)
     check_cxx_source_runs ("${source}" ${testname})
   endif()
   set (${runs} "${${testname}}")
-endmacro (MULTIPASS_SOURCE_RUNS)
+endmacro ()
 
 macro (MULTIPASS_C_SOURCE_RUNS includes libraries source runs)
   multipass_source_runs("${includes}" "${libraries}" "${source}" ${runs} "C")
-endmacro (MULTIPASS_C_SOURCE_RUNS)
+endmacro ()
diff --git a/scripts/cmake/findPETSC/ResolveCompilerPaths.cmake b/scripts/cmake/findPETSC/ResolveCompilerPaths.cmake
index e7a470842f8..5928a3b90e7 100644
--- a/scripts/cmake/findPETSC/ResolveCompilerPaths.cmake
+++ b/scripts/cmake/findPETSC/ResolveCompilerPaths.cmake
@@ -55,9 +55,9 @@ macro (RESOLVE_LIBRARIES LIBS LINK_LINE)
       # It's a library, resolve the path by looking in the list and then (by default) in system directories
       if (WIN32) #windows expects "libfoo", linux expects "foo"
         string (REGEX REPLACE "^-l" "lib" token ${token})
-      else (WIN32)
+      else ()
         string (REGEX REPLACE "^-l" "" token ${token})
-      endif (WIN32)
+      endif ()
       set (_root)
       if (token MATCHES "^/") # We have an absolute path
         #separate into a path and a library name:
@@ -66,26 +66,26 @@ macro (RESOLVE_LIBRARIES LIBS LINK_LINE)
         convert_cygwin_path(libpath)
         set (_directory_list ${_directory_list} ${libpath})
         set (token ${libname})
-      endif (token MATCHES "^/")
+      endif ()
       set (_lib "NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
       find_library (_lib ${token} HINTS ${_directory_list} ${_root})
       if (_lib)
   string (REPLACE "//" "/" _lib ${_lib})
         list (APPEND _libs_found ${_lib})
-      else (_lib)
+      else ()
         message (STATUS "Unable to find library ${token}")
-      endif (_lib)
-    endif (token MATCHES "-L([^\" ]+|\"[^\"]+\")")
-  endforeach (token)
+      endif ()
+    endif ()
+  endforeach ()
   set (_lib "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE)
   # only the LAST occurence of each library is required since there should be no circular dependencies
   if (_libs_found)
     list (REVERSE _libs_found)
     list (REMOVE_DUPLICATES _libs_found)
     list (REVERSE _libs_found)
-  endif (_libs_found)
+  endif ()
   set (${LIBS} "${_libs_found}")
-endmacro (RESOLVE_LIBRARIES)
+endmacro ()
 
 macro (RESOLVE_INCLUDES INCS COMPILE_LINE)
   string (REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" _all_tokens "${COMPILE_LINE}")
@@ -96,10 +96,10 @@ macro (RESOLVE_INCLUDES INCS COMPILE_LINE)
     convert_cygwin_path(token)
     if (EXISTS ${token})
       list (APPEND _incs_found ${token})
-    else (EXISTS ${token})
+    else ()
       message (STATUS "Include directory ${token} does not exist")
-    endif (EXISTS ${token})
-  endforeach (token)
+    endif ()
+  endforeach ()
   list (REMOVE_DUPLICATES _incs_found)
   set (${INCS} "${_incs_found}")
-endmacro (RESOLVE_INCLUDES)
+endmacro ()
-- 
GitLab