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. proper use of CMAKE_SOURCE_DIR
Forum Updated to NodeBB v4.3 + New Features

proper use of CMAKE_SOURCE_DIR

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 520 Views 1 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.
  • M Offline
    M Offline
    mzimmers
    wrote on 11 Sept 2023, 16:37 last edited by
    #1

    Hi all -

    I'm trying to follow a Qt example on translations. In the video, the narrator adds this line to his CMakeLists.txt file:

    qt_create_translation(QM_FILES $(CMAKE_SOURCE_DIR) simplequick.ts)
    

    I've added an equivalent line to my file, and when trying to build, I get a rather strange-looking error:

    ninja: error: 'C:/Users/Michael.Zimmers/Qt_projects/nga_demo/$(CMAKE_SOURCE_DIR)', needed by '.lupdate/latin.ts.stamp', missing and no known rule to make it
    

    ("latin.ts" is the name of my .ts file -- it's currently empty.)
    I tried adding a definition for CMAKE_SOURCE_DIR in my project configuration, but that didn't change anything.

    Any ideas what I'm doing wrong here? Thanks...

    C 1 Reply Last reply 11 Sept 2023, 16:42
    0
    • M mzimmers
      11 Sept 2023, 16:37

      Hi all -

      I'm trying to follow a Qt example on translations. In the video, the narrator adds this line to his CMakeLists.txt file:

      qt_create_translation(QM_FILES $(CMAKE_SOURCE_DIR) simplequick.ts)
      

      I've added an equivalent line to my file, and when trying to build, I get a rather strange-looking error:

      ninja: error: 'C:/Users/Michael.Zimmers/Qt_projects/nga_demo/$(CMAKE_SOURCE_DIR)', needed by '.lupdate/latin.ts.stamp', missing and no known rule to make it
      

      ("latin.ts" is the name of my .ts file -- it's currently empty.)
      I tried adding a definition for CMAKE_SOURCE_DIR in my project configuration, but that didn't change anything.

      Any ideas what I'm doing wrong here? Thanks...

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 11 Sept 2023, 16:42 last edited by
      #2

      I am pretty sure the video is correct but you read it wrong. Cmake is using curly brackets for variables.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      M 1 Reply Last reply 11 Sept 2023, 16:48
      1
      • C Christian Ehrlicher
        11 Sept 2023, 16:42

        I am pretty sure the video is correct but you read it wrong. Cmake is using curly brackets for variables.

        M Offline
        M Offline
        mzimmers
        wrote on 11 Sept 2023, 16:48 last edited by
        #3

        @Christian-Ehrlicher and I'm pretty sure you're right. (I think I need a vacation.) Thanks for catching that.

        As long as we're on the general subject (sort of), later, he includes this line:

        #install(FILES ${qm_files} DESTINATION ${INSTALL_EXAMPLEDIR})
        

        I'm assuming that he defined INSTALL_EXAMPLEDIR but he doesn't explicitly mention it. Which Qt variable should I substitute for my project? (I'm using a conventional shadow build.)

        Thanks...

        C 1 Reply Last reply 11 Sept 2023, 16:57
        0
        • M mzimmers
          11 Sept 2023, 16:48

          @Christian-Ehrlicher and I'm pretty sure you're right. (I think I need a vacation.) Thanks for catching that.

          As long as we're on the general subject (sort of), later, he includes this line:

          #install(FILES ${qm_files} DESTINATION ${INSTALL_EXAMPLEDIR})
          

          I'm assuming that he defined INSTALL_EXAMPLEDIR but he doesn't explicitly mention it. Which Qt variable should I substitute for my project? (I'm using a conventional shadow build.)

          Thanks...

          C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 11 Sept 2023, 16:57 last edited by
          #4

          I personally install qm files either in an 'translations' subdir or directly embed them in the resource file.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          M 1 Reply Last reply 11 Sept 2023, 17:04
          0
          • C Christian Ehrlicher
            11 Sept 2023, 16:57

            I personally install qm files either in an 'translations' subdir or directly embed them in the resource file.

            M Offline
            M Offline
            mzimmers
            wrote on 11 Sept 2023, 17:04 last edited by
            #5

            @Christian-Ehrlicher said in proper use of CMAKE_SOURCE_DIR:

            I personally install qm files either in an 'translations' subdir or directly embed them in the resource file.

            Oh, I guess I misunderstood that line -- I thought he was referring to the build directory. But your answer implies that the install is actually within the source directory.

            I think I'd like to use the first approach you mentioned. Should I create a variable for this directory within Creator, or is there something predefined for this purpose?

            Thanks...

            1 Reply Last reply
            0
            • M mzimmers has marked this topic as solved on 9 Nov 2023, 16:53

            1/5

            11 Sept 2023, 16:37

            • Login

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