Skip to content

Instantly share code, notes, and snippets.

@glcoder
Created January 19, 2015 09:16
Show Gist options
  • Save glcoder/14ca181bddfde497010d to your computer and use it in GitHub Desktop.
Save glcoder/14ca181bddfde497010d to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 2.6)
project(gl3w)
include(FindPythonInterp)
if(PYTHONINTERP_FOUND)
execute_process(COMMAND ${PYTHON_EXECUTABLE} gl3w_gen.py
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif(PYTHONINTERP_FOUND)
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
set(BUILD_DEFINES "" CACHE STRING "Build defines")
include_directories(${CMAKE_SOURCE_DIR}/include)
set(HEADERS include/GL/gl3w.h include/GL/glcorearb.h)
set(SOURCES ${HEADERS} src/gl3w.c)
if(DEFINED BUILD_DEFINES)
add_definitions(${BUILD_DEFINES})
endif()
if(BUILD_SHARED_LIBS)
add_library(gl3w SHARED ${SOURCES})
else()
add_library(gl3w STATIC ${SOURCES})
endif()
install(TARGETS gl3w
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/GL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment