FLTK logo

[fltk/fltk] `fltk-config` returns wrong LDFLAGS on Windows (#260)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

[fltk/fltk] `fltk-config` returns wrong LDFLAGS on Windows (#260) Markus Mützel Jul 19, 2021  
 

See also this report for MSYS2: msys2/MINGW-packages#8806

The fltk-config program that is installed by MSYS2 returns the following:

$ fltk-config --use-gl --ldflags
-L/mingw64/lib -lfltk_gl -lGLU -lGL -lfltk -lpthread

AFAICT, there are no GLU or GL libraries on Windows. Instead of -lGLU -lGL these flags should probably contain -lopengl32 -lglu32.

That causes linker issues when trying to compile projects that use fltk-config to get the linker flags for FLTK with OpenGL support.

It would be nice if fltk-config on Windows could return flags that can be used for successful linking on MinGW.

@revelator suggested the following patch in the above issue which works for me:

diff -urN fltk-release-1.3.5.a/CMake/options.cmake fltk-release-1.3.5.b/CMake/options.cmake
--- fltk-release-1.3.5.a/CMake/options.cmake	2019-03-03 09:40:23.000000000 +0100
+++ fltk-release-1.3.5.b/CMake/options.cmake	2021-06-13 02:41:02.238878100 +0200
@@ -150,7 +150,11 @@
 
 if(OPENGL_FOUND)
    set(CMAKE_REQUIRED_INCLUDES ${OPENGL_INCLUDE_DIR}/GL)
-   set(GLLIB "-lGLU -lGL")
+   if(WIN32)
+     set(GLLIB "-lglu32 -lopengl32")
+   else()
+     set(GLLIB "-lGLU -lGL")
+   endif(WIN32)
 
    # check if function glXGetProcAddressARB exists
    set(TEMP_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})

Would that change be ok in general?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.