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 () endif ()
option (GLEW_X11 "X11 mode" ON) option (GLEW_X11 "X11 mode" ON)
option (GLEW_EGL "EGL mode" OFF) 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}/../..) set (GLEW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
@ -162,11 +163,9 @@ else()
endif() endif()
set(targets_to_install "") set(targets_to_install "")
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
list(APPEND targets_to_install glew) list(APPEND targets_to_install glew)
endif() else ()
if(NOT DEFINED BUILD_SHARED_LIBS OR NOT BUILD_SHARED_LIBS)
list(APPEND targets_to_install glew_s) list(APPEND targets_to_install glew_s)
endif() endif()
@ -184,7 +183,7 @@ if (BUILD_UTILS)
list (APPEND GLEWINFO_SRC_FILES ${GLEW_DIR}/build/glewinfo.rc) list (APPEND GLEWINFO_SRC_FILES ${GLEW_DIR}/build/glewinfo.rc)
endif () endif ()
add_executable (glewinfo ${GLEWINFO_SRC_FILES}) 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) target_link_libraries (glewinfo glew)
else() else()
target_link_libraries (glewinfo glew_s) target_link_libraries (glewinfo glew_s)
@ -198,7 +197,7 @@ if (BUILD_UTILS)
list (APPEND VISUALINFO_SRC_FILES ${GLEW_DIR}/build/visualinfo.rc) list (APPEND VISUALINFO_SRC_FILES ${GLEW_DIR}/build/visualinfo.rc)
endif () endif ()
add_executable (visualinfo ${VISUALINFO_SRC_FILES}) 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) target_link_libraries (visualinfo glew)
else() else()
target_link_libraries (visualinfo glew_s) target_link_libraries (visualinfo glew_s)