CMake: Add BUILD_SHARED_LIBS option

This commit is contained in:
Julien Schueller 2021-03-18 16:41:23 +01:00 committed by Nigel Stewart
parent e34bb212f6
commit 2b16160853

View File

@ -26,6 +26,7 @@ if (APPLE)
endif ()
option (GLEW_X11 "X11 mode" ON)
option (GLEW_EGL "EGL mode" OFF)
option (BUILD_SHARED_LIBS "install/link shared instead of static libs" ON)
set (GLEW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
@ -162,11 +163,9 @@ else()
endif()
set(targets_to_install "")
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
if(BUILD_SHARED_LIBS)
list(APPEND targets_to_install glew)
endif()
if(NOT DEFINED BUILD_SHARED_LIBS OR NOT BUILD_SHARED_LIBS)
else ()
list(APPEND targets_to_install glew_s)
endif()
@ -184,7 +183,7 @@ if (BUILD_UTILS)
list (APPEND GLEWINFO_SRC_FILES ${GLEW_DIR}/build/glewinfo.rc)
endif ()
add_executable (glewinfo ${GLEWINFO_SRC_FILES})
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
if(BUILD_SHARED_LIBS)
target_link_libraries (glewinfo glew)
else()
target_link_libraries (glewinfo glew_s)
@ -198,7 +197,7 @@ if (BUILD_UTILS)
list (APPEND VISUALINFO_SRC_FILES ${GLEW_DIR}/build/visualinfo.rc)
endif ()
add_executable (visualinfo ${VISUALINFO_SRC_FILES})
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
if(BUILD_SHARED_LIBS)
target_link_libraries (visualinfo glew)
else()
target_link_libraries (visualinfo glew_s)