  set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
  set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
  set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-@@ -46,14 +57,14 @@ include_directories (${GLEW_DIR}/include)
+@@ -46,14 +58,14 @@ include_directories (${GLEW_DIR}/include)
  add_library (glew SHARED ${GLEW_DIR}/src/glew.c)
  set_target_properties (glew PROPERTIES COMPILE_DEFINITIONS "GLEW_BUILD" OUTPUT_NAME "${GLEW_LIB_NAME}" PREFIX "${DLL_PREFIX}")
  add_library (glew_s STATIC ${GLEW_DIR}/src/glew.c)

 
 option (BUILD_UTILS "utilities" ON)
 
@@ -25,6 +28,14 @@ file (STRINGS ${GLEW_DIR}/config/version  _VERSION_PATCH_STRING REGEX "GLEW_MICR
 string (REGEX REPLACE "GLEW_MICRO[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_PATCH ${_VERSION_PATCH_STRING})
 set (GLEW_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
 

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..c7bf4b7
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.0)
+project(glew)
+include(flags OPTIONAL)
+add_subdirectory(build/cmake)
diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
index 1563f9f..0636a9b 100644
--- a/build/cmake/CMakeLists.txt
+++ b/build/cmake/CMakeLists.txt
@@ -2,15 +2,19 @@ if ( NOT DEFINED CMAKE_BUILD_TYPE )
   set( CMAKE_BUILD_TYPE Release CACHE STRING "Build type" )
 endif ()
 
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
 project (glew)
 
 cmake_minimum_required (VERSION 2.4)
+endif()
 
 if (COMMAND cmake_policy)
   cmake_policy (SET CMP0003 NEW)
