Showing with 11 additions and 20 deletions.
  1. +11 −20 CMakeLists.txt
@@ -1,8 +1,8 @@
project(GLFW C)

cmake_minimum_required(VERSION 2.8.9)
cmake_minimum_required(VERSION 2.8.12)

if (CMAKE_VERSION VERSION_EQUAL "3.0" OR CMAKE_VERSION VERSION_GREATER "3.0")
if (NOT CMAKE_VERSION VERSION_LESS "3.0")
# Until all major package systems have moved to CMake 3,
# we stick with the older INSTALL_NAME_DIR mechanism
cmake_policy(SET CMP0042 OLD)
@@ -72,7 +72,6 @@ if (GLFW_USE_EGL)
message(FATAL_ERROR "Unsupported client library")
endif()

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake/modules")
find_package(EGL REQUIRED)

if (NOT _GLFW_USE_OPENGL)
@@ -84,6 +83,8 @@ else()
set(_GLFW_USE_OPENGL 1)
endif()

set(CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")

if (_GLFW_USE_OPENGL)
find_package(OpenGL REQUIRED)
elseif (_GLFW_USE_GLESV1)
@@ -137,7 +138,6 @@ endif()

if (MINGW)
# Enable link-time exploit mitigation features enabled by default on MSVC

include(CheckCCompilerFlag)

# Compatibility with data execution prevention (DEP)
@@ -160,6 +160,12 @@ if (MINGW)
if (_GLFW_HAS_64ASLR)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}")
endif()

# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
# the inclusion of stddef.h (by glfw3.h), which is itself included before
# win32_platform.h. We define them here until a saner solution can be found
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
add_definitions(-DUNICODE -DWINVER=0x0501)
endif()

#--------------------------------------------------------------------
@@ -217,14 +223,6 @@ if (_GLFW_WIN32)
if (GLFW_USE_OPTIMUS_HPG)
set(_GLFW_USE_OPTIMUS_HPG 1)
endif()

# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
# the inclusion of stddef.h (by glfw3.h), which is itself included before
# win32_platform.h. We define them here until a saner solution can be found
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
add_definitions(-DUNICODE -DWINVER=0x0501)
endif()
endif()

#--------------------------------------------------------------------
@@ -402,14 +400,7 @@ if (_GLFW_GLX)
NOT _GLFW_HAS_GLXGETPROCADDRESSEXT)
message(WARNING "No glXGetProcAddressXXX variant found")

# Check for dlopen support as a fallback

set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_DL_LIBS}")
check_function_exists(dlopen _GLFW_HAS_DLOPEN)
if (NOT _GLFW_HAS_DLOPEN)
message(FATAL_ERROR "No entry point retrieval mechanism found")
endif()

set(_GLFW_HAS_DLOPEN 1)
if (CMAKE_DL_LIBS)
list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}")
list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}")