mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-11 09:33:49 +00:00
[Fix #39] Fix CMP0048 issue
This commit is contained in:
parent
67ff18e2ee
commit
5cc3b4b8a8
@ -1,5 +1,22 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.12)
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
project("glew")
|
|
||||||
|
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/config/version _VERSION_MAJOR_STRING REGEX "GLEW_MAJOR[ ]*=[ ]*[0-9]+.*")
|
||||||
|
string(REGEX REPLACE "GLEW_MAJOR[ ]*=[ ]*([0-9]+)" "\\1" MAJOR_VERSION ${_VERSION_MAJOR_STRING})
|
||||||
|
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/config/version _VERSION_MINOR_STRING REGEX "GLEW_MINOR[ ]*=[ ]*[0-9]+.*")
|
||||||
|
string(REGEX REPLACE "GLEW_MINOR[ ]*=[ ]*([0-9]+)" "\\1" MINOR_VERSION ${_VERSION_MINOR_STRING})
|
||||||
|
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/config/version _VERSION_PATCH_STRING REGEX "GLEW_MICRO[ ]*=[ ]*[0-9]+.*")
|
||||||
|
string(REGEX REPLACE "GLEW_MICRO[ ]*=[ ]*([0-9]+)" "\\1" PATCH_VERSION ${_VERSION_PATCH_STRING})
|
||||||
|
set(GLEW_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
|
||||||
|
|
||||||
|
if(NOT CMAKE_VERSION VERSION_LESS 3.0)
|
||||||
|
cmake_policy(SET CMP0048 NEW)
|
||||||
|
project("glew" VERSION ${GLEW_VERSION} LANGUAGES C)
|
||||||
|
else()
|
||||||
|
project("glew" C)
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR ${MAJOR_VERSION})
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH ${MAJOR_VERSION})
|
||||||
|
endif()
|
||||||
|
|
||||||
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
set(INCLUDE_DIR "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>$<INSTALL_INTERFACE:include>")
|
set(INCLUDE_DIR "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>$<INSTALL_INTERFACE:include>")
|
||||||
@ -17,14 +34,6 @@ option(USE_GLU "Use GLU" OFF)
|
|||||||
option(PKG_CONFIG_REPRESENTATIVE_TARGET "Generate pc file for specified target as glew. libglew_static|libglew_shared" OFF)
|
option(PKG_CONFIG_REPRESENTATIVE_TARGET "Generate pc file for specified target as glew. libglew_static|libglew_shared" OFF)
|
||||||
option(ONLY_LIBS "Do not build executables" OFF)
|
option(ONLY_LIBS "Do not build executables" OFF)
|
||||||
|
|
||||||
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/config/version _VERSION_MAJOR_STRING REGEX "GLEW_MAJOR[ ]*=[ ]*[0-9]+.*")
|
|
||||||
string(REGEX REPLACE "GLEW_MAJOR[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_MAJOR ${_VERSION_MAJOR_STRING})
|
|
||||||
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/config/version _VERSION_MINOR_STRING REGEX "GLEW_MINOR[ ]*=[ ]*[0-9]+.*")
|
|
||||||
string(REGEX REPLACE "GLEW_MINOR[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_MINOR ${_VERSION_MINOR_STRING})
|
|
||||||
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/config/version _VERSION_PATCH_STRING REGEX "GLEW_MICRO[ ]*=[ ]*[0-9]+.*")
|
|
||||||
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})
|
|
||||||
|
|
||||||
set(LIBGLEW_SRCS ${SRC_DIR}/glew.c)
|
set(LIBGLEW_SRCS ${SRC_DIR}/glew.c)
|
||||||
|
|
||||||
set(DEFINITIONS)
|
set(DEFINITIONS)
|
||||||
@ -37,7 +46,7 @@ if(MSVC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Use namespaced libraries when supported
|
# Use namespaced libraries when supported
|
||||||
if(${CMAKE_VERSION} VERSION_GREATER 3.14)
|
if(NOT CMAKE_VERSION VERSION_LESS 3.14)
|
||||||
set(USE_NAMESPACED_LIB YES)
|
set(USE_NAMESPACED_LIB YES)
|
||||||
else()
|
else()
|
||||||
set(USE_NAMESPACED_LIB NO)
|
set(USE_NAMESPACED_LIB NO)
|
||||||
|
Loading…
Reference in New Issue
Block a user