Fix shared library build for mingw

This commit is contained in:
Gyusun Yeom 2021-03-05 21:55:15 +09:00
parent f1c0b06b1b
commit 78f10dd0e0

View File

@ -178,13 +178,20 @@ if(glew-cmake_BUILD_SHARED)
endif() endif()
target_compile_definitions(libglew_shared PRIVATE GLEW_BUILD) target_compile_definitions(libglew_shared PRIVATE GLEW_BUILD)
if(MINGW)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
target_link_options(libglew_shared PRIVATE -nostdlib)
else()
target_link_libraries(libglew_shared PRIVATE -nostdlib)
endif()
endif()
list(APPEND GLEW_TARGETS libglew_shared) list(APPEND GLEW_TARGETS libglew_shared)
endif() endif()
foreach(GLEW_TARGET ${GLEW_TARGETS}) foreach(GLEW_TARGET ${GLEW_TARGETS})
target_compile_definitions(${GLEW_TARGET} PUBLIC ${DEFINITIONS}) target_compile_definitions(${GLEW_TARGET} PUBLIC ${DEFINITIONS})
target_include_directories(${GLEW_TARGET} PUBLIC ${INCLUDE_DIR}) target_include_directories(${GLEW_TARGET} PUBLIC ${INCLUDE_DIR})
target_link_libraries(${GLEW_TARGET} ${LIBRARIES}) target_link_libraries(${GLEW_TARGET} PUBLIC ${LIBRARIES})
set_target_properties(${GLEW_TARGET} PROPERTIES VERSION ${GLEW_VERSION}) set_target_properties(${GLEW_TARGET} PROPERTIES VERSION ${GLEW_VERSION})
endforeach() endforeach()