CMake file formatting.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5e6554c..a445436 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,7 +27,7 @@
     # Set up library and include paths
     list(APPEND GLFW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR})
     list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY})
-endif (WIN32)
+endif()
 
 #--------------------------------------------------------------------
 # Set up GLFW for Xlib and GLX on Unix-like systems with X Windows
@@ -47,12 +47,12 @@
     find_library(MATH_LIBRARY m)
     if (MATH_LIBRARY)
         list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY})
-    endif(MATH_LIBRARY)
+    endif()
 
     find_library(RT_LIBRARY rt)
     if (RT_LIBRARY)
         list(APPEND GLFW_LIBRARIES ${RT_LIBRARY})
-    endif(RT_LIBRARY)
+    endif()
 
     include(CheckFunctionExists)
     include(CheckSymbolExists)
@@ -83,24 +83,22 @@
 
     if (NOT _GLFW_HAS_GLXGETPROCADDRESS)
         check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB)
-    endif (NOT _GLFW_HAS_GLXGETPROCADDRESS)
+    endif()
 
     if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB)
         check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT)
-    endif (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB)
+    endif()
 
     if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND
         NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
         NOT _GLFW_HAS_GLXGETPROCADDRESSEXT)
         message(WARNING "No glXGetProcAddressXXX variant found")
-    endif (NOT _GLFW_HAS_GLXGETPROCADDRESS AND
-           NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
-           NOT _GLFW_HAS_GLXGETPROCADDRESSEXT)
+    endif()
 
     if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
         set(_GLFW_USE_LINUX_JOYSTICKS 1)
-    endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
-endif(UNIX AND NOT APPLE)
+    endif()
+endif()
 
 #--------------------------------------------------------------------
 # Set up GLFW for Cocoa and NSOpenGL on Mac OS X
@@ -121,7 +119,7 @@
         set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5") 
     else(GLFW_BUILD_UNIVERSAL)
         message(STATUS "Building GLFW only for the native architecture")
-    endif(GLFW_BUILD_UNIVERSAL)
+    endif()
     
     # Set up library and include paths
     find_library(COCOA_FRAMEWORK Cocoa)
@@ -131,7 +129,7 @@
     list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY})
     list(APPEND GLFW_LIBRARIES ${IOKIT_FRAMEWORK})
     list(APPEND GLFW_LIBRARIES ${CORE_FOUNDATION_FRAMEWORK})
-endif(UNIX AND APPLE)
+endif()
 
 #--------------------------------------------------------------------
 # Add subdirectories
@@ -140,11 +138,11 @@
 
 if (GLFW_BUILD_EXAMPLES)
     add_subdirectory(examples)
-endif(GLFW_BUILD_EXAMPLES)
+endif()
 
 if (GLFW_BUILD_TESTS)
     add_subdirectory(tests)
-endif(GLFW_BUILD_TESTS)
+endif()
 
 #--------------------------------------------------------------------
 # Create shared configuration header
@@ -175,7 +173,7 @@
 # Uninstall operation
 # Don't generate this target if a higher-level project already has
 #--------------------------------------------------------------------
-if(NOT TARGET uninstall)
+if (NOT TARGET uninstall)
     configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in
                    ${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY)
 
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index d511b22..37b7f75 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -7,14 +7,14 @@
                     ${GLFW_SOURCE_DIR}/support
                     ${OPENGL_INCLUDE_DIR})
 
-if(APPLE)
+if (APPLE)
   # Set fancy names for bundles
   add_executable(Boing MACOSX_BUNDLE boing.c)
   add_executable(Gears MACOSX_BUNDLE gears.c)
   add_executable("Split View" MACOSX_BUNDLE splitview.c)
   add_executable(Triangle MACOSX_BUNDLE triangle.c)
   add_executable(Wave MACOSX_BUNDLE wave.c)
-else(APPLE)
+else()
   # Set boring names for executables
   add_executable(boing WIN32 boing.c)
   add_executable(gears WIN32 gears.c)
@@ -22,13 +22,13 @@
   add_executable(splitview WIN32 splitview.c)
   add_executable(triangle WIN32 triangle.c)
   add_executable(wave WIN32 wave.c)
-endif(APPLE)
+endif()
 
 set(WINDOWS_BINARIES boing gears heightmap splitview triangle wave)
 
-if(MSVC)
+if (MSVC)
   # Tell MSVC to use main instead of WinMain for Windows subsystem executables
   set_target_properties(${WINDOWS_BINARIES} PROPERTIES
                         LINK_FLAGS "/ENTRY:mainCRTStartup")
-endif(MSVC)
+endif()
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 79a5c31..bdc4d5f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,15 +1,15 @@
 
 if(UNIX)
-    if(_GLFW_HAS_XRANDR)
+    if (_GLFW_HAS_XRANDR)
         set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr")
-    endif(_GLFW_HAS_XRANDR)
-    if(_GLFW_HAS_XF86VIDMODE)
+    endif()
+    if (_GLFW_HAS_XF86VIDMODE)
         set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xxf86vm")
-    endif(_GLFW_HAS_XF86VIDMODE)
+    endif()
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake 
                    ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY)
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig)
-endif(UNIX)
+endif()
 
 include_directories(${GLFW_SOURCE_DIR}/src
                     ${GLFW_BINARY_DIR}/src
@@ -37,7 +37,7 @@
                         x11_window.c)
 else()
     message(FATAL_ERROR "No supported platform was selected")
-endif(_GLFW_COCOA_NSGL)
+endif()
 
 add_library(libglfwStatic STATIC ${libglfw_SOURCES})
 add_library(libglfwShared SHARED ${libglfw_SOURCES}) 
@@ -54,16 +54,16 @@
                           PREFIX ""
                           IMPORT_PREFIX ""
                           IMPORT_SUFFIX "dll.lib")
-endif(WIN32)
+endif()
 
 if(APPLE)
     # Append -fno-common to the compile flags to work around a bug in the Apple GCC
     get_target_property(CFLAGS libglfwShared COMPILE_FLAGS)
-    if(NOT CFLAGS)
+    if (NOT CFLAGS)
         set(CFLAGS "")
-    endif(NOT CFLAGS)
+    endif()
     set_target_properties(libglfwShared PROPERTIES COMPILE_FLAGS "${CFLAGS} -fno-common")
-endif(APPLE)
+endif()
 
 install(TARGETS libglfwStatic libglfwShared DESTINATION lib)
 
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index d7ac095..5863160 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -61,9 +61,9 @@
 set(CONSOLE_BINARIES defaults events fsaa fsfocus gamma glfwinfo iconify
                      joysticks listmodes peter reopen)
 
-if(MSVC)
+if (MSVC)
   # Tell MSVC to use main instead of WinMain for Windows subsystem executables
   set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
                         LINK_FLAGS "/ENTRY:mainCRTStartup")
-endif(MSVC)
+endif()