Fix warnings and CMake issue.

This commit is contained in:
Wes Tarro 2016-02-06 13:30:15 -05:00
parent 32b2ea5266
commit 02fc17f511
2 changed files with 6 additions and 6 deletions

View File

@ -79,6 +79,7 @@ static GLenum GLEWAPIENTRY glewContextInit ()
const GLubyte* s; const GLubyte* s;
GLuint dot; GLuint dot;
GLint major, minor; GLint major, minor;
size_t n;
/* query opengl version */ /* query opengl version */
getString = (PFNGLGETSTRINGPROC) glewGetProcAddress((const GLubyte*)"glGetString"); getString = (PFNGLGETSTRINGPROC) glewGetProcAddress((const GLubyte*)"glGetString");
@ -124,7 +125,6 @@ static GLenum GLEWAPIENTRY glewContextInit ()
GLEW_VERSION_1_1 = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE; GLEW_VERSION_1_1 = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
} }
size_t n;
for (n = 0; n < sizeof(_glewExtensionString) / sizeof(_glewExtensionString[0]); ++n) for (n = 0; n < sizeof(_glewExtensionString) / sizeof(_glewExtensionString[0]); ++n)
_glewExtensionString[n] = GL_FALSE; _glewExtensionString[n] = GL_FALSE;

View File

@ -4,7 +4,7 @@ endif ()
project (glew) project (glew)
cmake_minimum_required (VERSION 2.4) cmake_minimum_required (VERSION 2.8.7)
if (COMMAND cmake_policy) if (COMMAND cmake_policy)
cmake_policy (SET CMP0003 NEW) cmake_policy (SET CMP0003 NEW)
@ -92,20 +92,20 @@ if (MSVC)
# add options from visual studio project # add options from visual studio project
target_compile_definitions (glew PRIVATE "GLEW_BUILD;VC_EXTRALEAN") target_compile_definitions (glew PRIVATE "GLEW_BUILD;VC_EXTRALEAN")
target_compile_definitions (glew_s PRIVATE "GLEW_STATIC;VC_EXTRALEAN") target_compile_definitions (glew_s PRIVATE "GLEW_STATIC;VC_EXTRALEAN")
target_link_libraries (glew PRIVATE -BASE:0x62AA0000) target_link_libraries (glew LINK_PRIVATE -BASE:0x62AA0000)
# kill security checks which are dependent on stdlib # kill security checks which are dependent on stdlib
target_compile_options (glew PRIVATE -GS-) target_compile_options (glew PRIVATE -GS-)
target_compile_options (glew_s PRIVATE -GS-) target_compile_options (glew_s PRIVATE -GS-)
# remove stdlib dependency # remove stdlib dependency
target_link_libraries (glew PRIVATE -nodefaultlib -noentry) target_link_libraries (glew LINK_PRIVATE -nodefaultlib -noentry)
elseif (WIN32 AND ((CMAKE_C_COMPILER_ID MATCHES "GNU") OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))) elseif (WIN32 AND ((CMAKE_C_COMPILER_ID MATCHES "GNU") OR (CMAKE_C_COMPILER_ID MATCHES "Clang")))
# remove stdlib dependency on windows with GCC and Clang (for similar reasons # remove stdlib dependency on windows with GCC and Clang (for similar reasons
# as to MSVC - to allow it to be used with any Windows compiler) # as to MSVC - to allow it to be used with any Windows compiler)
target_compile_options (glew PRIVATE -fno-builtin -fno-stack-protector) target_compile_options (glew PRIVATE -fno-builtin -fno-stack-protector)
target_compile_options (glew_s PRIVATE -fno-builtin -fno-stack-protector) target_compile_options (glew_s PRIVATE -fno-builtin -fno-stack-protector)
target_link_libraries (glew PRIVATE -nostdlib) target_link_libraries (glew LINK_PRIVATE -nostdlib)
endif () endif ()
target_link_libraries (glew PUBLIC ${GLEW_LIBRARIES}) target_link_libraries (glew LINK_PUBLIC ${GLEW_LIBRARIES})
target_link_libraries (glew_s ${GLEW_LIBRARIES}) target_link_libraries (glew_s ${GLEW_LIBRARIES})
if(CMAKE_VERSION VERSION_LESS 2.8.12) if(CMAKE_VERSION VERSION_LESS 2.8.12)