Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. CMake Creating a library of sub-components

CMake Creating a library of sub-components

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 137 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tapsbrighton
    wrote on last edited by
    #1

    I’m trying to create a huge library and have decided to modularize that project by developing it component by component so that I can easily test and develop each component separately.
    But in the end all these components need to be compiled into one single library.
    So my root CMakeLists.txt has a couple of add_subdirectory() calls.
    Each sub-component is compiled as a STATIC lib.

    My challenge now is how do I make the root CMakeLists.txt compile everything into one single lib.

    How do I call add_library() in such a case?

    jsulmJ 1 Reply Last reply
    0
    • T tapsbrighton

      I’m trying to create a huge library and have decided to modularize that project by developing it component by component so that I can easily test and develop each component separately.
      But in the end all these components need to be compiled into one single library.
      So my root CMakeLists.txt has a couple of add_subdirectory() calls.
      Each sub-component is compiled as a STATIC lib.

      My challenge now is how do I make the root CMakeLists.txt compile everything into one single lib.

      How do I call add_library() in such a case?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @tapsbrighton said in CMake Creating a library of sub-components:

      How do I call add_library() in such a case?

      You put add_library() in each subdirectory.
      In the main folder you link all these static libs to your big lib using target_link_libraries after calling add_library for the big library. Don't forget to include the subfolders.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved