Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-124589

qt_add_plugin puts dlls in CMAKE_LIBRARY_OUTPUT_DIRECTORY

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 6.7.0
    • Build System: CMake
    • None
    • Windows

    Description

      On windows, the qt_add_plugin() macro builds dlls in CMAKE_LIBRARY_OUTPUT_DIRECTORY, whereas qt_add_library() and add_library() both use CMAKE_RUNTIME_OUTPUT_DIRECTORY.

      Example CMakeLists.txt:

      {{cmake_minimum_required(VERSION 3.27.0)

      set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "myarchivedir")
      set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "mylibrarydir")
      set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "myruntimedir") # This is used for dlls in windows

      project(test)

      find_package(Qt6 REQUIRED COMPONENTS Core)

      #add_library(test SHARED test.cpp) # Uses CMAKE_RUNTIME_OUTPUT_DIRECTORY
      #qt_add_library(test SHARED test.cpp) # Uses CMAKE_RUNTIME_OUTPUT_DIRECTORY
      qt_add_plugin(test SHARED test.cpp) # Uses CMAKE_LIBRARY_OUTPUT_DIRECTORY}}

      {{ build> c:\Qt\Tools\CMake_64\bin\cmake.exe -G Ninja .. -DCMAKE_PREFIX_PATH=C:/Qt/6.7.0/msvc2019_64
      build>ninja
      [2/2] Linking CXX shared module mylibrarydir\test.dll}}

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtbuildsystem Qt Build System Team
            srcejon Jon Beniston
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes