Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8665087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:23:53+00:00 2026-06-12T17:23:53+00:00

In CMake I have a folder containing predefined Gettext catalogs, which at build time

  • 0

In CMake I have a folder containing predefined Gettext catalogs, which at build time I copy to a folder and then modify them. But the problem is that every time I run the target it’ll copy the predefined file on the local copy (which is probably modified). Is there a way to copy if the file is different to a state it was before, otherwise leave it alone?

I was also thinking that a way to do this would be to copy them across at CMake generation time, but I feel a little weary of doing that as people may delete the folders and screw things up. Also I don’t know how to perform commands at generation time, only at build time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:23:54+00:00Added an answer on June 12, 2026 at 5:23 pm

    Alrighty, I managed to fix this a while back but forgot about this answer. Sorry all the people who’ve skipped over this and not had the answer!

    # ----- Copy and merge across the po files that come with the source.
    
    message("Copying and updating stock translations...")
    
    file(GLOB poFiles "${stockDir}/*.po")
    
    foreach(file ${poFiles})
      # Get the language name, like en_US or zh_CN from the name of the po file, so
      # 'en_US.po' or 'zh_CN.po' become 'en_US' or 'zh_CN.po'
      get_filename_component(langName ${file} NAME_WE)
    
      set(newFile "${langDir}/${langName}.po")
    
      if(NOT EXISTS ${newFile})
        execute_process(COMMAND ${MSGMERGE_EXECUTABLE}
          "--output-file" ${newFile} ${file} ${potFile}
          OUTPUT_QUIET ERROR_VARIABLE error RESULT_VARIABLE ret)
    
        if(ret) # Have to do this hack as msgmerge prints to stderr.
          message(SEND_ERROR "${error}")
        endif()
    
        message(" '${langName}' copied.")
      elseif(${file} IS_NEWER_THAN ${newFile})
         execute_process(COMMAND ${MSGMERGE_EXECUTABLE}
           "--update" ${newFile} ${file}
           OUTPUT_QUIET ERROR_VARIABLE error RESULT_VARIABLE ret)
    
         if(ret) # Have to do this hack as msgmerge prints to stderr.
           message(SEND_ERROR "${error}")
         endif()
    
         message(" '${langName}' merged.")
      endif()
    endforeach()
    

    stockDir is the directory containing the stocked po files that aren’t meant to be user edited (unless committing to the repo). langDir is in the build directory under ‘lang’. It goes through, and either copies or updates it based on the files’ age.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed python 3. But cmake .. shows an error: PYTHON3_INCLUDE_DIR detected at
I have tried setting the debug flags using the set command in cmake but
I have downloaded mysql-connector-c-6.0.2. I build it using below commands: cmake -G Unix Makefiles
I am using CMake to build my project and I have the following line:
I have an out-of-source build setup with cmake and I am trying to generate
I'm starting to learn how to use CMake, but I have had several problems
I'm new to CMake. Therefore, I have several questions which I don't want to
I am trying to build a big project with CMake but I struggle on
I have a project that is build with cmake. In my cmakelists I have
I used CMake and Visual C++ to build the HyDE library. Then, still in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.