mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-24 23:55:06 +00:00
Merge https://github.com/nigels-com/glew.git into master HEAD at Mon Oct 16 00:01:34 GMT 2023
This commit is contained in:
commit
338306293e
@ -1,25 +1,12 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
project(glew LANGUAGES C)
|
||||||
|
|
||||||
if ( NOT DEFINED CMAKE_BUILD_TYPE )
|
if ( NOT DEFINED CMAKE_BUILD_TYPE )
|
||||||
set( CMAKE_BUILD_TYPE Release CACHE STRING "Build type" )
|
set( CMAKE_BUILD_TYPE Release CACHE STRING "Build type" )
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
project (glew C)
|
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 3.16)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
if(POLICY CMP0003)
|
|
||||||
cmake_policy (SET CMP0003 NEW)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(POLICY CMP0042)
|
|
||||||
cmake_policy (SET CMP0042 NEW)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (POLICY CMP0072)
|
|
||||||
cmake_policy (SET CMP0072 NEW)
|
|
||||||
endif(POLICY CMP0072)
|
|
||||||
|
|
||||||
set(CMAKE_DEBUG_POSTFIX d)
|
set(CMAKE_DEBUG_POSTFIX d)
|
||||||
|
|
||||||
option (BUILD_UTILS "utilities" ON)
|
option (BUILD_UTILS "utilities" ON)
|
||||||
@ -51,14 +38,6 @@ endif()
|
|||||||
|
|
||||||
find_package (OpenGL REQUIRED)
|
find_package (OpenGL REQUIRED)
|
||||||
|
|
||||||
# cmake<3.10 doesn't detect EGL/GLX
|
|
||||||
if (CMAKE_VERSION VERSION_LESS 3.10)
|
|
||||||
find_library(OPENGL_egl_LIBRARY NAMES EGL)
|
|
||||||
if (OPENGL_egl_LIBRARY)
|
|
||||||
set (OpenGL_EGL_FOUND TRUE)
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# prefer GLVND
|
# prefer GLVND
|
||||||
if (OPENGL_opengl_LIBRARY)
|
if (OPENGL_opengl_LIBRARY)
|
||||||
set (GLEW_LIBRARIES ${OPENGL_opengl_LIBRARY})
|
set (GLEW_LIBRARIES ${OPENGL_opengl_LIBRARY})
|
||||||
@ -178,15 +157,10 @@ endif()
|
|||||||
target_link_libraries (glew LINK_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)
|
target_compile_definitions(glew_s INTERFACE "GLEW_STATIC")
|
||||||
set(MAYBE_EXPORT "")
|
foreach(t glew glew_s)
|
||||||
else()
|
target_include_directories(${t} PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
target_compile_definitions(glew_s INTERFACE "GLEW_STATIC")
|
endforeach()
|
||||||
foreach(t glew glew_s)
|
|
||||||
target_include_directories(${t} PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
|
||||||
endforeach()
|
|
||||||
set(MAYBE_EXPORT EXPORT glew-targets)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(targets_to_install "")
|
set(targets_to_install "")
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
@ -196,7 +170,7 @@ else ()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
install ( TARGETS ${targets_to_install}
|
install ( TARGETS ${targets_to_install}
|
||||||
${MAYBE_EXPORT}
|
EXPORT glew-targets
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
|
||||||
@ -258,7 +232,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/glew.pc
|
|||||||
COMPONENT Development
|
COMPONENT Development
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600) AND (NOT CMAKE_VERSION VERSION_LESS "3.1"))
|
if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600))
|
||||||
install(
|
install(
|
||||||
FILES $<TARGET_PDB_FILE:glew>
|
FILES $<TARGET_PDB_FILE:glew>
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
@ -272,16 +246,14 @@ install (
|
|||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GL
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GL
|
||||||
COMPONENT Development)
|
COMPONENT Development)
|
||||||
|
|
||||||
if(MAYBE_EXPORT)
|
install(EXPORT glew-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew
|
||||||
install(EXPORT glew-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew
|
COMPONENT Development
|
||||||
COMPONENT Development
|
NAMESPACE GLEW::)
|
||||||
NAMESPACE GLEW::)
|
install(FILES
|
||||||
install(FILES
|
${CMAKE_CURRENT_SOURCE_DIR}/glew-config.cmake
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/glew-config.cmake
|
${CMAKE_CURRENT_SOURCE_DIR}/CopyImportedTargetProperties.cmake
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CopyImportedTargetProperties.cmake
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew
|
COMPONENT Development)
|
||||||
COMPONENT Development)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT TARGET uninstall)
|
if(NOT TARGET uninstall)
|
||||||
configure_file(
|
configure_file(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.12)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(glew-cmake-test)
|
project(glew-cmake-test LANGUAGES C)
|
||||||
|
|
||||||
find_package(GLEW REQUIRED CONFIG)
|
find_package(GLEW REQUIRED CONFIG)
|
||||||
find_package(GLEW REQUIRED CONFIG) # call twice to test multiple call
|
find_package(GLEW REQUIRED CONFIG) # call twice to test multiple call
|
||||||
@ -10,14 +10,8 @@ set_target_properties(cmake-test PROPERTIES DEBUG_POSTFIX _d)
|
|||||||
target_link_libraries(cmake-test PRIVATE GLEW::GLEW ${OPENGL_LIBRARIES})
|
target_link_libraries(cmake-test PRIVATE GLEW::GLEW ${OPENGL_LIBRARIES})
|
||||||
target_include_directories(cmake-test PRIVATE ${OPENGL_INCLUDE_DIR})
|
target_include_directories(cmake-test PRIVATE ${OPENGL_INCLUDE_DIR})
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.0)
|
|
||||||
set(cgex $<CONFIGURATION>)
|
|
||||||
else()
|
|
||||||
set(cgex $<CONFIG>)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_compile_definitions(cmake-test PRIVATE
|
target_compile_definitions(cmake-test PRIVATE
|
||||||
-DGLEW_CMAKE_TEST_CONFIG=${cgex}
|
-DGLEW_CMAKE_TEST_CONFIG=$<CONFIG>
|
||||||
-DGLEW_CMAKE_TEST_TARGET_FILE_NAME=$<TARGET_FILE_NAME:GLEW::GLEW>
|
-DGLEW_CMAKE_TEST_TARGET_FILE_NAME=$<TARGET_FILE_NAME:GLEW::GLEW>
|
||||||
-DGLEW_CMAKE_TEST_TARGET_TYPE=$<TARGET_PROPERTY:GLEW::GLEW,TYPE>
|
-DGLEW_CMAKE_TEST_TARGET_TYPE=$<TARGET_PROPERTY:GLEW::GLEW,TYPE>
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user