View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013126CMakeCMakepublic2012-04-13 06:472016-06-10 14:31
Reporterkislinsk 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformMSVCOSWindowsOS Version
Product VersionCMake 2.8.7 
Target VersionFixed in Version 
Summary0013126: SOURCE_GROUP does not work for regular expressions AND no-name groups
DescriptionCMake creates the default source groups (in context of MSVC "filters") "Header Files" and "Source Files" for convenience and puts all files to the appropriate group. This behavior can be overwritten by specifying own source groups and put each and every file to them. If there is any file left, both default source groups will be created. OK, fine so far.

Imagine the following scenario where you want to put each file into a source group that matches its path:

Foo.h
Foo.cpp
Bar/Bar.h
Bar/Bar.cpp

The following snippet works:

source_group("" FILES Foo.h Foo.cpp) # no-name group -> no filter
source_group(Bar FILES Bar/Bar.h Bar/Bar.cpp)
add_executable(FooBar Foo.h Foo.cpp Bar/Bar.h Bar/Bar.cpp)

No "Header Files" nor "Source Files" filters are generated, only the "Bar" filter containing Bar.h and Bar.cpp. Foo.h and Foo.cpp are located at the top level of the project. Perfect!

Of course you have more files in a real world scenario so you may prefer to use the regular expression versions of source_group which work well except for the case of a no-name group:

source_group("" "[^/]+\\.(cpp|h)") # BUG!
source_group(Bar "Bar/[^/]+\\.(cpp|h)")

For simplicity you can reduce the regular expressions to something like "Foo\\.(cpp|h)" and "Bar/Bar\\.(cpp|h)", it doesn't matter.

With a regular expression no-name groups do not work at all. "Header Files" and "Source Files" filters are created and everything is put into them instead.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0030401)
David Cole (manager)
2012-08-11 21:35

Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0042023)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2012-04-13 06:47 kislinsk New Issue
2012-08-11 21:35 David Cole Status new => backlog
2012-08-11 21:35 David Cole Note Added: 0030401
2016-06-10 14:28 Kitware Robot Note Added: 0042023
2016-06-10 14:28 Kitware Robot Status backlog => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team