mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-11 09:33:49 +00:00
Export cmake config & use proper include directory for install
Close #30 Thanks Lanza<nathan@lanza.io>
This commit is contained in:
parent
9f3df6c128
commit
430a36d2b8
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.12)
|
|||||||
project("glew")
|
project("glew")
|
||||||
|
|
||||||
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
set(INCLUDE_DIR "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
||||||
set(RC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build)
|
set(RC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build)
|
||||||
|
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
||||||
@ -63,6 +63,8 @@ else()
|
|||||||
list(APPEND LIBRARIES GL X11 dl Xext)
|
list(APPEND LIBRARIES GL X11 dl Xext)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(GLEW_TARGETS)
|
||||||
|
|
||||||
if(glew-cmake_BUILD_STATIC)
|
if(glew-cmake_BUILD_STATIC)
|
||||||
add_library(libglew_static STATIC ${LIBGLEW_SRCS})
|
add_library(libglew_static STATIC ${LIBGLEW_SRCS})
|
||||||
|
|
||||||
@ -74,7 +76,7 @@ if(glew-cmake_BUILD_STATIC)
|
|||||||
target_compile_definitions(libglew_static PUBLIC GLEW_STATIC ${DEFINITIONS})
|
target_compile_definitions(libglew_static PUBLIC GLEW_STATIC ${DEFINITIONS})
|
||||||
target_link_libraries(libglew_static ${LIBRARIES} )
|
target_link_libraries(libglew_static ${LIBRARIES} )
|
||||||
set_target_properties(libglew_static PROPERTIES VERSION ${GLEW_VERSION})
|
set_target_properties(libglew_static PROPERTIES VERSION ${GLEW_VERSION})
|
||||||
install(TARGETS libglew_static ARCHIVE DESTINATION lib)
|
list(APPEND GLEW_TARGETS libglew_static)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(glew-cmake_BUILD_SHARED)
|
if(glew-cmake_BUILD_SHARED)
|
||||||
@ -94,10 +96,7 @@ if(glew-cmake_BUILD_SHARED)
|
|||||||
target_include_directories(libglew_shared PUBLIC ${INCLUDE_DIR})
|
target_include_directories(libglew_shared PUBLIC ${INCLUDE_DIR})
|
||||||
target_link_libraries(libglew_shared ${LIBRARIES})
|
target_link_libraries(libglew_shared ${LIBRARIES})
|
||||||
set_target_properties(libglew_shared PROPERTIES VERSION ${GLEW_VERSION})
|
set_target_properties(libglew_shared PROPERTIES VERSION ${GLEW_VERSION})
|
||||||
install(TARGETS libglew_shared
|
list(APPEND GLEW_TARGETS libglew_shared)
|
||||||
ARCHIVE DESTINATION lib
|
|
||||||
LIBRARY DESTINATION lib
|
|
||||||
RUNTIME DESTINATION bin)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PKG_CONFIG_REPRESENTATIVE_TARGET)
|
if(PKG_CONFIG_REPRESENTATIVE_TARGET)
|
||||||
@ -105,8 +104,15 @@ if(PKG_CONFIG_REPRESENTATIVE_TARGET)
|
|||||||
NAME "glew"
|
NAME "glew"
|
||||||
LIBRARY_DIR lib
|
LIBRARY_DIR lib
|
||||||
${pc_requires})
|
${pc_requires})
|
||||||
|
add_library(glew ALIAS ${PKG_CONFIG_REPRESENTATIVE_TARGET})
|
||||||
|
list(APPEND GLEW_TARGETS glew)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
install(TARGETS ${GLEW_TARGETS}
|
||||||
|
EXPORT glew-cmake
|
||||||
|
ARCHIVE DESTINATION lib)
|
||||||
|
install(EXPORT glew-cmake DESTINATION lib/cmake/glew FILE glewConfig.cmake)
|
||||||
|
|
||||||
file(GLOB PUBLIC_HEADERS "include/GL/*.h")
|
file(GLOB PUBLIC_HEADERS "include/GL/*.h")
|
||||||
install(FILES ${PUBLIC_HEADERS} DESTINATION include/GL/)
|
install(FILES ${PUBLIC_HEADERS} DESTINATION include/GL/)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user