diff --git a/CMakeLists.txt b/CMakeLists.txt
index f6aaa90f1794aa52aa6273f11a6971eed5434fb4..cf56616c8c5ad1c7c2d40d86e8c0f009471deaa4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -635,6 +635,14 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
   ENDIF(EXECUTABLE_OUTPUT_PATH)
 
   IF(BUILD_TESTING)
+
+    GET_TARGET_PROPERTY(TEST_SYSTEMTOOLS_EXE testSystemTools LOCATION)
+    SET(TEST_SYSTEMTOOLS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/testSystemTools.cxx")
+    CONFIGURE_FILE(
+      ${PROJECT_SOURCE_DIR}/testSystemTools.h.in
+      ${PROJECT_BINARY_DIR}/testSystemTools.h)
+    INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
+
     IF(CTEST_TEST_KWSYS)
       CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ExtraTest.cmake.in"
         "${CMAKE_CURRENT_BINARY_DIR}/ExtraTest.cmake")
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index f160562a580cd2792ac644902cca658a19a8c17e..cf16c0ebacb7ca77dc2ac42c031177c3b27bd49e 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -27,6 +27,8 @@
 # include "kwsys_ios_iostream.h.in"
 #endif
 
+#include "testSystemTools.h"
+
 //----------------------------------------------------------------------------
 const char* toUnixPaths[][2] = 
 {
@@ -90,6 +92,32 @@ bool CheckEscapeChars(kwsys_stl::string input,
   return true;
 }
 
+//----------------------------------------------------------------------------
+bool CheckDetectFileType()
+{
+  bool res = true;
+
+  if (kwsys::SystemTools::DetectFileType(TEST_SYSTEMTOOLS_EXE) != 
+      kwsys::SystemTools::FileTypeBinary)
+    {
+    kwsys_ios::cerr 
+      << "Problem with DetectFileType - failed to detect type of: " 
+      << TEST_SYSTEMTOOLS_EXE << kwsys_ios::endl;
+    res = false;
+    }
+
+  if (kwsys::SystemTools::DetectFileType(TEST_SYSTEMTOOLS_SRC) != 
+      kwsys::SystemTools::FileTypeText)
+    {
+    kwsys_ios::cerr 
+      << "Problem with DetectFileType - failed to detect type of: " 
+      << TEST_SYSTEMTOOLS_SRC << kwsys_ios::endl;
+    res = false;
+    }
+
+  return res;
+}
+
 //----------------------------------------------------------------------------
 int main(/*int argc, char* argv*/)
 {
@@ -115,5 +143,7 @@ int main(/*int argc, char* argv*/)
                             *checkEscapeChars[cc][2], checkEscapeChars[cc][3]);
     }
 
+  res &= CheckDetectFileType();
+
   return res ? 0 : 1;
 }
diff --git a/testSystemTools.h.in b/testSystemTools.h.in
new file mode 100644
index 0000000000000000000000000000000000000000..ae2d79b06d8dca6250f5c0514f2e8f98b2327bb8
--- /dev/null
+++ b/testSystemTools.h.in
@@ -0,0 +1,20 @@
+/*=========================================================================
+
+  Program:   KWSys - Kitware System Library
+  Module:    testSystemTools.h.in
+
+  Copyright (c) Kitware, Inc., Insight Consortium.  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef @KWSYS_NAMESPACE@_testSystemtools_h
+#define @KWSYS_NAMESPACE@_testSystemtools_h
+
+#define TEST_SYSTEMTOOLS_EXE "@TEST_SYSTEMTOOLS_EXE@"
+#define TEST_SYSTEMTOOLS_SRC "@TEST_SYSTEMTOOLS_SRC@"
+
+#endif