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

  • Home
  • SEARCH
  • 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 8870937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:51:29+00:00 2026-06-14T17:51:29+00:00

I am using the following custom command to copy all the files within the

  • 0

I am using the following custom command to copy all the files within the config directory into the build directory. The problem is that I don’t want the .svn directory to be copied as well. I am looking for a way to either exclude the .svn directory or to copy files with specific extension. e.g. I want only files with xml or conf extensions to be copied. What should I do?

add_custom_command(TARGET MyTarget PRE_BUILD
                   COMMAND ${CMAKE_COMMAND} -E copy_directory
                       ${CMAKE_SOURCE_DIR}/config $<TARGET_FILE_DIR:MyTarget>)

related question

  • 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-14T17:51:31+00:00Added an answer on June 14, 2026 at 5:51 pm

    To copy just the .xml and .conf files, you can use the file(GLOB ...) command:

    # Gather list of all .xml and .conf files in "/config"
    file(GLOB ConfigFiles ${CMAKE_SOURCE_DIR}/config/*.xml
                          ${CMAKE_SOURCE_DIR}/config/*.conf)
    
    foreach(ConfigFile ${ConfigFiles})
      add_custom_command(TARGET MyTarget PRE_BUILD
                         COMMAND ${CMAKE_COMMAND} -E
                             copy ${ConfigFile} $<TARGET_FILE_DIR:MyTarget>)
    endforeach()
    

    It’s a similar process to get all files not in the .svn subdirectory:

    # Gather list of all files in "/config"
    file(GLOB ConfigFiles RELATIVE ${CMAKE_SOURCE_DIR}/config
         ${CMAKE_SOURCE_DIR}/config/*)
    
    # Gather list of all files in "/config/.svn"
    file(GLOB SvnConfigFiles RELATIVE ${CMAKE_SOURCE_DIR}/config 
         ${CMAKE_SOURCE_DIR}/config/.svn/*)
    
    # Remove ".svn" and its contents from the list
    list(REMOVE_ITEM ConfigFiles .svn ${SvnConfigFiles})
    
    foreach(ConfigFile ${ConfigFiles})
      add_custom_command(TARGET MyTarget PRE_BUILD
                         COMMAND ${CMAKE_COMMAND} -E
                             copy ${CMAKE_SOURCE_DIR}/config/${ConfigFile}
                                  $<TARGET_FILE_DIR:MyTarget>)
    endforeach()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an activity that appears as a dialog using the following custom theme:
I'm using the following logic to add a custom handler to a form that's
I create a custom schema in my DB2 database using the following command: db2
friends, i have created custom title bar using following titlebar.xml file with code <?xml
I am using the following CSS to define a custom font on a webpage:
To use custom layout file in my app I'm using this following code, set
I'm using the following script for a window.onload custom radio button replacement (http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/custom-form-elements.js) and
I have following code using hibernate to throw a custom exception on error and
I am using custom UserNamePasswordValidator for User Authentication. Following is the code and it
I have built a few custom applications that run on WSS 3 using the

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.