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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on 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...

    Christian EhrlicherC 1 Reply Last reply
    0
    • mzimmersM mzimmers

      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...

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 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

      mzimmersM 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

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

        mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on 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...

        Christian EhrlicherC 1 Reply Last reply
        0
        • mzimmersM mzimmers

          @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...

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 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

          mzimmersM 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

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

            mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on 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
            • mzimmersM mzimmers has marked this topic as solved on

            • Login

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