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. Changing qmake to cmake
Qt 6.11 is out! See what's new in the release blog

Changing qmake to cmake

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 938 Views 2 Watching
  • 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.
  • G Offline
    G Offline
    Gibbz
    wrote on last edited by
    #1

    I have a small c++ project im trying to convert from qmake to cmake.
    The pro and cmake files can be found on github https://github.com/bit-shift-io/audiobook

    My setup seems to be okay till the build gets to 100%. It fails with the errors bellow. I assume this is because I rely on the LibTag library... How can I include this in my cmake?

    [100%] Linking CXX executable audiobook
    /usr/bin/ld: CMakeFiles/audiobook.dir/src/library.cpp.o: in function `Library::get_time_msec(QFileInfo)':
    library.cpp:(.text+0x999): undefined reference to `TagLib::FileRef::FileRef(char const*, bool, TagLib::AudioProperties::ReadStyle)'
    /usr/bin/ld: library.cpp:(.text+0x9bd): undefined reference to `TagLib::FileRef::file() const'
    /usr/bin/ld: library.cpp:(.text+0x9d4): undefined reference to `TagLib::AudioProperties::lengthInMilliseconds() const'
    /usr/bin/ld: library.cpp:(.text+0x9e6): undefined reference to `TagLib::FileRef::~FileRef()'
    /usr/bin/ld: library.cpp:(.text+0xa33): undefined reference to `TagLib::FileRef::~FileRef()'
    /usr/bin/ld: CMakeFiles/audiobook.dir/src/audioutil.cpp.o: in function `AudioUtil::get_time_msec(QString const&)':
    audioutil.cpp:(.text+0x396): undefined reference to `TagLib::FileRef::FileRef(char const*, bool, TagLib::AudioProperties::ReadStyle)'
    /usr/bin/ld: audioutil.cpp:(.text+0x3ae): undefined reference to `TagLib::FileRef::file() const'
    /usr/bin/ld: audioutil.cpp:(.text+0x3c5): undefined reference to `TagLib::AudioProperties::lengthInMilliseconds() const'
    /usr/bin/ld: audioutil.cpp:(.text+0x3d7): undefined reference to `TagLib::FileRef::~FileRef()'
    /usr/bin/ld: audioutil.cpp:(.text+0x413): undefined reference to `TagLib::FileRef::~FileRef()'
    collect2: error: ld returned 1 exit status
    make[2]: *** [CMakeFiles/audiobook.dir/build.make:210: audiobook] Error 1
    make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/audiobook.dir/all] Error 2
    make: *** [Makefile:130: all] Error 2
    
    
    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I'm a novice in cmake myself, so I'm not sure about this, but I think you need to add your libtag to:

      target_link_libraries(audiobook Qt5::Widgets)
      

      Perhaps something like this will work:

      target_link_libraries(audiobook Qt5::Widgets taglib)
      

      (Z(:^

      1 Reply Last reply
      1
      • G Offline
        G Offline
        Gibbz
        wrote on last edited by
        #3

        I think the problem is in my config bellow.
        The libtag doesnt look like its building correctly ${CMAKE_CURRENT_SOURCE_DIR}/build/taglib/lib/libtag.so does not exists.
        ${CMAKE_CURRENT_BINARY_DIR}/taglib/src/taglib is empty also!

        # TagLib
        ExternalProject_Add(
            taglib
            URL https://taglib.org/releases/taglib-${TAGLIB_VERSION}.tar.gz
            URL_MD5 ${TAGLIB_CHECKSUM}
            CONFIGURE_COMMAND ${CMAKE_COMMAND}
                              ${CMAKE_CURRENT_BINARY_DIR}/taglib/src/taglib
                              -DCMAKE_MAKE_PROGRAM=${UNIX_MAKE_PROGRAM}
                              -DBUILD_SHARED_LIBS=ON
                              -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/build/taglib/
        
            PREFIX taglib
            INSTALL_COMMAND ${UNIX_MAKE_PROGRAM} install
        )
        add_library(tag SHARED IMPORTED)
        set_target_properties(tag PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/build/taglib/lib/libtag.so)
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          @Gibbz said in Changing qmake to cmake:

          TAGLIB_VERSION

          Is that variable defined somewhere ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

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