Results 1 to 2 of 2

Thread: Qt5 CMake include all libraries into executable

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,311
    Thanks
    314
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt5 CMake include all libraries into executable

    Have you read the section on Deployment in the Qt documentation?

    Running in a development environment (like Qt Creator or Visual Studio) works because the IDE has set up the paths to the DLLs and other binaries required to build and run programs. In a standalone environment, if the DLLs are not searchable via your PATH variable or are not installed as described in the Deployment documentation, the program will not run and will give the error you are seeing.

    All the TARGET_LINK_LIBRARIES() command in your CMakelists file is doing is telling CMake to link your program with the -import libraries- (.lib) to resolve any symbols that will later have to be located in the DLLs that are loaded at runtime. It has nothing to do with telling the executable where to find those DLLs at run time.

    If you specify an "install()" command in your CMakelists file, you can use it to deploy your executable and the DLLs it needs to execute. You can then run it standalone from a command prompt after you have CD'd to that directory.
    Last edited by d_stranz; 25th March 2020 at 20:16.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 4
    Last Post: 6th March 2019, 20:57
  2. include cmake inside qmake
    By shenakan in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2011, 15:15
  3. how set icon for qt executable project file with cmake and vs 2005?
    By banlinhtienphong in forum Qt Programming
    Replies: 3
    Last Post: 28th April 2011, 08:38
  4. Qt + Eclipse + MinGW + Windows: How to include libraries?
    By jambrek in forum General Programming
    Replies: 3
    Last Post: 19th December 2007, 13:57
  5. Replies: 2
    Last Post: 30th September 2007, 21:23

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.