From 78f10dd0e0a15690fd76339ed61fc2a33e7b8e8f Mon Sep 17 00:00:00 2001 From: Gyusun Yeom Date: Fri, 5 Mar 2021 21:55:15 +0900 Subject: [PATCH] Fix shared library build for mingw --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index af80c65..9b61307 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,13 +178,20 @@ if(glew-cmake_BUILD_SHARED) endif() 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) endif() foreach(GLEW_TARGET ${GLEW_TARGETS}) target_compile_definitions(${GLEW_TARGET} PUBLIC ${DEFINITIONS}) 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}) endforeach()