FLTK logo

Re: [fltk/fltk] CMake: Use imported targets for PkgConfig packages (PR #954)

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 ]

Re: [fltk/fltk] CMake: Use imported targets for PkgConfig packages (PR #954) Jordan Williams 05:18 Apr 15  
 

I think the only remaining patch left for the Conan package just disables building the static fltk library at all when doing a shared library build.

The FLTK "philosophy" has always been to build the static libs and opt-in to building shared libs, and that's why we ignore CMake's BUILD_SHARED_LIBS variable in general and always use STATIC as default. In fact someone opened an issue to build only shared libs (#753) but I dismissed it recently because it became too complex, given that we'd have to build our tools like fluid, fltk-options, and all test programs with shared libs if we accepted this request. Sure, if we only wanted to build the FLTK libs alone, no executables (fluid, fltk-options), and no test programs, then we could probably have done it (see this comment).

One problem with a shared-library-only build would be on Windows where we need to execute fluid during the build, but if it was built using the shared lib (DLL), then this DLL would have to be in a place where the system (i.e. fluid) would find it during build time, etc. etc..

Another "problem" was the definition of appropriate and backwards compatible CMake option names that would allow to disable the static libraries and build only the shared libs. And last but not least, what would the CMake target names be if either the static or the shared libs were built? Currently we have fltk::fltk and (optional) fltk::fltk-shared. If we built only the shared libs, what would their target names be, maybe fltk::fltk? How would consumers of FLTK know that?

That said, if you have a patch that considers all of these issues I'd be all ear and would be interested to see it. Can you point me at an existing patch in Conan?

Yeah, I could tell it wouldn't be very straightforward for fltk since you support building both shared and static libraries simultaneously. I don't really know a good way of handling that in CMake. I think most projects that do this end up rolling their own way of doing it unfortunately, and I'm not very familiar with it. I've seen that Meson projects have a much easier time doing this since they have a both_libraries function that can be used when creating a library.

The patch for Conan is here and is super simple because we don't need to support all of the use cases you do.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <fltk/fltk/pull/954/c2056714795@github.com>

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'.