CMake install does not place runtime libraries under bin [Windows] (Issue #23527)

581 views
Skip to first unread message

Burak Can

unread,
May 5, 2023, 6:02:30 PM5/5/23
to wx-...@googlegroups.com, Subscribed

Repository

wxwidgets_scaffold

Workflow and Purpose

Consuming WxWidgets as a subdirectory using git submodules. The wx_ui target consumes the wxwidgets target. The purpose here is to have the wx_ui executable and its dependencies under defined install/bin directory.

# Configure from root
cmake -S . -B build -G "Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=install
# Build & install
cmake  --build build --config Release --target install

After running these commands, configuration and build are done successfully. However, the installation logic is not the one I desire.

Issues

  1. As seen below, the wxwidgets dependencies are placed under lib directory instead of bin under install directory. When you run the executable, the obvious happens and it throws the system error complaining cannot proceed because wxmsw330u)core_vcx64_custom.dll was not found.

image

  1. The installation process also collects the static libs and headers under installation directory as follows:

image

image

Questions

  1. Is collecting the dynamic libraries under lib by design? Am I missing to pass a CMake variable to change it? What is the way to bring the wxwidgets dependent dynamic libraries under bin or is there any wxwidgets way of doing this properly?
  2. Consider this project as a final product and I don't want to pass/install/pack wxwidgets headers and static libraries under installation directory. How can I achieve that here?

System

  • Windows 10
  • CMake: 3.25.2
  • CMake diagnostics during configuration:
    -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
    -- Which libraries should wxWidgets use?
        wxUSE_REGEX:    builtin  (enable support for wxRegEx class)
        wxUSE_ZLIB:     builtin  (use zlib for LZW compression)
        wxUSE_EXPAT:    builtin  (use expat for XML parsing)
        wxUSE_LIBJPEG:  builtin  (use libjpeg (JPEG file format))
        wxUSE_LIBPNG:   builtin  (use libpng (PNG image format))
        wxUSE_LIBTIFF:  builtin  (use libtiff (TIFF file format))
        wxUSE_NANOSVG:  builtin  (use NanoSVG for rasterizing SVG)
        wxUSE_LIBLZMA:  OFF      (use liblzma for LZMA compression)
      -- Configured wxWidgets 3.3.0 for Windows-10.0.19045
          Min OS Version required at runtime:  Windows Vista / Windows Server 2008 (x64 Edition)
          Which GUI toolkit should wxWidgets use?            msw
          Should wxWidgets be compiled into single library?  OFF
          Should wxWidgets be linked as a shared library?    ON
          Which wxWidgets API compatibility should be used?  3.2
    
   


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

Maarten

unread,
May 5, 2023, 6:54:32 PM5/5/23
to wx-...@googlegroups.com, Subscribed

Hi,

  1. The wxWidgets install target was designed to do a full installation of the wxWidgets library for developers. So it includes all the headers and libraries. Your use case is (I think) never considered.

  2. You should be able to disable wxWidgets installation by setting the wxBUILD_INSTALL option to off.
    Googling also showed you might be able to use EXCLUDE_FROM_ALL to prevent the wxWidgets libary from installing: add_subdirectory(wx_widgets EXCLUDE_FROM_ALL).

wxWidgets' CMake system does not have a feature to install the used (or all) shared libraries to the install folder.
One solution I can think of is to get the output filename of the wxWidgets targets you use. Untested, but something like this for the base libarry: get_target_property(libname wx::base OUTPUT_NAME).
and then install them using install(FILES allLibNames DESTINATION bin).


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23527/1536870281@github.com>

oneeyeman1

unread,
May 5, 2023, 7:59:00 PM5/5/23
to wx-...@googlegroups.com, Subscribed

Hi,
Another solution would be to use static linking of wxWidgets so that no extra library is needed.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23527/1536918803@github.com>

Burak Can

unread,
May 6, 2023, 10:11:17 AM5/6/23
to wx-...@googlegroups.com, Subscribed

Thanks for the responses.

  • As defined in 'CMake install' docs, runtime dlls are expected under 'bin' directory. What would the main motive(reason) be for placing 'dlls' under 'lib'?

  • Looks like I have to play some games against CMake to disable installing 'headers' and 'static libs' and moving binaries around.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23527/1537150528@github.com>

oneeyeman1

unread,
May 6, 2023, 10:20:10 AM5/6/23
to wx-...@googlegroups.com, Subscribed

Why do you want to install static libs?

There is a reason they called static...


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23527/1537152162@github.com>

Burak Can

unread,
May 6, 2023, 11:15:33 AM5/6/23
to wx-...@googlegroups.com, Subscribed

Why do you want to install static libs?

There is a reason they called static...

No, I don't want static libs and headers. I only want to install WxWidgets runtime libs(dlls) to be located under 'bin'.

Consuming WxWdigets as static libs is an option but I'm looking for solutions when I consume WxWidgets as shared(dynamic) libs.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23527/1537162626@github.com>

Steffen Olszewski

unread,
May 24, 2023, 10:43:06 AM5/24/23
to wx-...@googlegroups.com, Subscribed

wxWidgets is a library and its CMake files are designed to install it as library, hence its shared libraries are installed under lib (i would love if it would use lib64 on platforms that use that naming style, but thats are different story). When building a library as part of your own build, you usually do not install the library itself, you install it as runtime dependency of your own application with install(RUNTIME_DEPENDENCIES). Using this command, you can control as part of your build where to install the files and adapt for the target platform, e.g. on Windows it is common to install them next to the binaries because of the lack of RPath.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23527/1561294049@github.com>

ncook-hxgn

unread,
Apr 15, 2024, 1:54:00 PM4/15/24
to wx-...@googlegroups.com, Subscribed

FWIW I'm building wxwidgets with the intention of packaging it as a/some nuget packages, and being able to build/install the static/dynamic flavours of wxwidgets to a named directory would make that easier.

I'm looking at LIBDIRNAME in makefile.vc (nmake build), but if the cmake build supported what @bc913 was asking for, I would prefer to use that.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23527/2057494144@github.com>

Reply all
Reply to author
Forward
0 new messages