Author Topic: Wildcards in paths of files in a project?  (Read 512 times)

Offline The_GTA

  • Single posting newcomer
  • *
  • Posts: 8
  • Developer
    • Magic.TXD
Wildcards in paths of files in a project?
« on: January 10, 2018, 08:32:48 pm »
Hello Code::Blocks community,

this is my first post. I would like to know if the Code::Blocks IDE supports wildcards like the Visual Studio IDE does. It is a helpful feature so that the project file does not have to be changed in case a new source code file was added to the source folder.

Example to add all .cpp files recursively in the "src" folder:
<Unit Filename="src/**/*.cpp" />

Example to add all .cpp files just in the "vendor" folder:
<Unit Filename="vendor/*.cpp" />

This is a great IDE! Keep up the good work.

- Martin

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10904
    • Travis build status
Re: Wildcards in paths of files in a project?
« Reply #1 on: January 10, 2018, 09:12:35 pm »
Yes, but there is no GUI support for this feature as far as I know.

See here for details: http://forums.codeblocks.org/index.php?topic=16958.0
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline The_GTA

  • Single posting newcomer
  • *
  • Posts: 8
  • Developer
    • Magic.TXD
Re: Wildcards in paths of files in a project?
« Reply #2 on: January 11, 2018, 02:33:30 pm »
Thank you very much, oBFusCATed ! This is exactly what I was looking for.

So using the examples provided by killerbot, my examples be written like this:

<UnitsGlob directory="src" wildcard="*.cpp" recursive="1" />
<UnitsGlob directory="vendor" wildcard="*.cpp" recursive="0" />

Confirmed working! See this example CBP file: http://svn.osdn.net/svnroot/peframework/build/peframework.cbp
This is great news! I feel confident about adding Code::Blocks projects as alternative build method. You know how makefiles have problems with spaces in paths? This is not a problem with Code::Blocks projects, am I right?

Despite you mentioning "no GUI support" killerbot has claimed that the file entries do show up in the GUI, at least. By reloading the project you get the recent file list aswell. This sounds like everything I would ever need anyway! :)

-----------------

Related but different, I would like to report a bug. When importing a MSVC project that has wildcard file entries, Code::Blocks does not resolve them.
Example:

Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  ( ... )
  <ItemGroup>
    <Natvis Include="peloader.natvis" />
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="..\src\**\*.cpp" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\include\**\*.h" />
    <ClInclude Include="..\src\**\*.h" />
    <ClInclude Include="..\src\**\*.hxx" />
  </ItemGroup>
  ( ... )
</Project>
(location: http://svn.osdn.net/svnroot/peframework/build/peframework.vcxproj)

Since Code::Blocks does have support for such things, could somebody please add support for the MSVC style wildcard aswell?

- Martin

EDIT: fixes for the examples, etc.
« Last Edit: January 11, 2018, 07:31:59 pm by The_GTA »

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1879
Re: Wildcards in paths of files in a project?
« Reply #3 on: January 11, 2018, 09:07:21 pm »
For bug reports the bug tracker on SF is the better place... Bugs reported in the forum will get lost...

Offline The_GTA

  • Single posting newcomer
  • *
  • Posts: 8
  • Developer
    • Magic.TXD
Re: Wildcards in paths of files in a project?
« Reply #4 on: January 11, 2018, 11:18:15 pm »
@BlueHazzard: I have posted a ticket here: https://sourceforge.net/p/codeblocks/tickets/598/
Using my pseudo-account.

Would really appreciate if you guys check it out.

- Martin