glew-cmake/CMakeLists.txt

63 lines
1.8 KiB
CMake
Raw Normal View History

CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
PROJECT( "glew" )
SET( SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src )
SET( INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include )
SET( RC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin )
INCLUDE_DIRECTORIES( ${INCLUDE_DIR} )
SET( LIBGLEW_SRCS ${SRC_DIR}/glew.c )
IF( WIN32 )
ADD_DEFINITIONS( -DWIN32_MEAN_AND_LEAN -DVC_EXTRALEAN -DGLEW_BUILD )
ENDIF( )
# MSVC11
IF( MSVC AND NOT MSVC11 )
LIST( APPEND LIBGLEW_SRCS ${RC_DIR}/glew.rc )
ENDIF( )
IF( NOT USE_GLU )
ADD_DEFINITIONS( -DGLEW_NO_GLU )
ENDIF( )
ADD_LIBRARY( libglew_static STATIC ${LIBGLEW_SRCS} )
ADD_LIBRARY( libglew_shared SHARED ${LIBGLEW_SRCS} )
2013-08-31 14:40:43 +00:00
IF( WIN32 )
SET( GL_LIBRARY opengl32 )
ELSEIF( APPLE )
FIND_LIBRARY( GL_LIBRARY OpenGL )
ELSE( )
SET( GL_LIBRARY GL )
ENDIF( )
2013-05-25 15:31:05 +00:00
SET_PROPERTY( TARGET libglew_static PROPERTY ARCHIVE_OUTPUT_NAME "glew" )
IF( WIN32 )
SET_PROPERTY( TARGET libglew_shared PROPERTY RUNTIME_OUTPUT_NAME "glew" )
ELSE( )
2013-05-25 15:31:05 +00:00
SET_PROPERTY( TARGET libglew_shared PROPERTY LIBRARY_OUTPUT_NAME "glew" )
ENDIF( )
2013-08-31 14:40:43 +00:00
TARGET_LINK_LIBRARIES( libglew_shared ${GL_LIBRARY} )
2013-05-25 05:34:35 +00:00
IF( ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR} AND NOT ONLY_LIBS )
SET( GLEWINFO_SRCS ${SRC_DIR}/glewinfo.c )
SET( VISUALINFO_SRCS ${SRC_DIR}/visualinfo.c )
IF( MSVS )
LIST( APPEND GLEWINFO_SRCS ${RC_DIR}/glewinfo.rc )
LIST( APPEND VISUALINFO_SRCS ${RC_DIR}/visualinfo.rc )
ENDIF( )
ADD_EXECUTABLE( glewinfo ${GLEWINFO_SRCS} )
ADD_EXECUTABLE( visualinfo ${VISUALINFO_SRCS} )
TARGET_LINK_LIBRARIES( glewinfo libglew_static ${GL_LIBRARY} )
TARGET_LINK_LIBRARIES( visualinfo libglew_static ${GL_LIBRARY} )
ENDIF( )