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 7947145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:20:56+00:00 2026-06-04T01:20:56+00:00

We’re using CMake to generate solution files for Visual Studio 2008. In addition to

  • 0

We’re using CMake to generate solution files for Visual Studio 2008. In addition to regular source projects that build libraries and executables, I’d like to have a project containing just configuration files. Those files are used to configure the behavior of the project at runtime. They are not needed to build the project, but having them included in the solution allows for convenient editing of those files. I was able to accomplish this using add_custom_target like so:

file(GLOB ini_files ${PROJECT_SOURCE_DIR}/../config/ini/*)
source_group(ini FILES ${ini_files})
file(GLOB xml_files ${PROJECT_SOURCE_DIR}/../config/xml/*)
source_group(xml FILES ${xml_files})
add_custom_target(config SOURCES ${ini_files} ${xml_files})

This gives me a “config” project that contains the configuration files as subfolders. However, there’s also a link named “config” to some non-existent file. I assume this is supposed to be the link to the target created by this rule. As there’s nothing to be built, this will remain a dead link. Now my questions are:

  1. Is add_custom_target the right way to accomplish what I want?
    If not, what would be a better solution?
  2. If it is the right way, how can I can I get rid of the link to the target’s name? Also, I’d like to remove the “CMake Rules” folder to make the config project as clean as possible.
  • 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-04T01:20:57+00:00Added an answer on June 4, 2026 at 1:20 am

    Visual Studio projects are essentially made to build targets depending on a set of source files.

    Having a project that exists just to list a set of static files is not advised, since as soon as you add a custom target, CMake will blindly try to create an output for the project, in order to remain compatible with other backend systems.
    Just imagine if CMake created a Unix Makefile with no actual target, that wouldn’t even be Makefile at all, would it ?

    The proper way to do this is to actually add the files to another existing project. Technically speaking, if you are building an executable, and this executable reads configuration files at runtime, these files are legitimately a part of the project.

    Also, I can’t recommend using file globing to list source files or configuration files, because if you add files in the folders, CMake will have no way to know that new files have been added, and the Visual Studio project will not be regenerated to include those files. Instead, you should list every file in your CMakeLists.txt files, so that adding the new file there will trigger cmake files regeneration.

    For the last point, if you really need “clean” projects, then CMake is not the tool you need, because everything it generates is useful to maintain a coherent build process.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.