cmake source_group has no effect - c++

I'm trying to organize a project generated for visual studio 2015 using the source_group function to add specific folders to the project, but it have no effect, here is how i do it:
set(CPP_FILES_REGEX "\\b(\\w|\\d)+\\b\\.(hpp|cpp|c|h)")
source_group("my_folder" REGULAR_EXPRESSION "${sourcers_dir}\/${CPP_FILES_REGEX}")
add_executable(my_executable ${sourcers_dir}/main.cpp ${sourcers_dir}/test.hpp)
Testes the regex here: RegExr and it works fine so the executables are being match. I also tried to add the file name but it still have no effect:
set(CPP_FILES_REGEX "\\b(\\w|\\d)+\\b\\.(hpp|cpp|c|h)")
source_group("my_folder" FILES "${sourcers_dir}/main.cpp")

CMake's regexes are fairly basic in what they understand, see the docs. "Fancy" named classes and pseudo-classes like \b, \w or \d are not supported. You'll have to spell them out manually (i.e. use [0-9] instead of \d etc.)

Related

Why are 'hidden' directories in OCaml projects prefixed with an underscore?

Examples are _opam and _build, these are commonly seen in OCaml projects and it baffles me that they don't use the usual dot prefix.
Is there a historical significance to this unique choice?
It's probably for the same reason .vimrc files are called _vimrc on Windows:
vimrc files in windows generally start with an underscore, "_vimrc" as Windows Explorer won't let you create files starting with a dot. Similarly, the ".vim" directory is called "vimfiles" on windows.
(from https://www.reddit.com/r/vim/comments/3v7g86/cant_get_vimrc_working_on_windows/cxkz9nr/ )

Geany "Find in files" breaks when brackets included in search string

I have Geany 1.27 installed in my UbuntuĀ 14.04 (Trusty Tahr). But I also have Windows 7 OS with Geany 1.28 installed.
In both these versions of Geany, when I try to find a string into a multiple files or folder with file-type filter of "phtml" or "php", I see that when my search string includes ( or ) (for example, function new() the search fails.
Now I have a slight idea that this could be due to un-escaped bracket in string acting as part of Regex in grep command. Am I right?
How can I overcome the unescaped characters in search string when searching in Geany? In both Ubuntu and Windows Geany if the method could be different.
Ensure you properly escape your braces, as depending on options, you have set the regular expression is used for searching.
Your function search would be something like new\(\). The documentation is more detailed.

Exclude folder except one subfolder via regular expression in Eclipse

I want to add a Resource Filter in Eclipse to exclude a folder named target including all it's files and subfolders except exactly one of this subfolders (target/scala-2.11/classes_managed).
Here is the regex I used for this (including examples for subdirectories):
https://regex101.com/r/aQ2qM1/1
In the referenced example it seems the regex works fine.
However when I apply this regex in Eclipse it does not work.
What's the correct way to write the regex so it works in Eclipse?
Thank you!
You don't need to get all fancy with regular expressions, you can tell eclipse to "Include only" the Folders with a Name matching:
target/scala-2.11/classes_managed
That will exclude all the files that you wish.

How to add files in hgignore files with tortoisehg?

In tortoisehg, i would like to add home/hello.php in .hgignore files but i don't know how to do this? It doesn't work. With somme regular expression?
I try home/hello.php in hgignore but it doesn't ignore anymore. Someone have idea?
I use glob syntax instead of regex because... well, regexes are scary demons. The following .hgignore file would ignore home/hello.php:
# use glob syntax
syntax: glob
# Project-specific files below here...
home/hello.php
You can find some fine examples of pre-made .hgignore files for common programming environments, such as this Visual Studio one.

Regex pattern search in TextPad fails, works in Visual Studio

I'm trying to use TextPad to search for a regular expression in several files. I have a simple pattern but it doesn't work in TextPad. It works fine in Visual Studio.
Anyone have any ideas?
I'm searching for:
hosted.mysite.com or host.mysite.com
using the pattern:
(hosted|host)\.mysite\.com
Use something like this
\(hosted\|host\).mysite.com
try this:
host\(ed\)?\.mysite\.com
Not every text editor uses the same regex/conventions. A regex you may get to work in Visual Studio won't necessarily work in Eclipse, Netbeans, or some other IDE or text editor.
In Textpad you need to escape some characters, such as parenthesis and pipes.
In your case, what you need is this:
\(hosted\|host\)\.mysite\.com
Note: you need to escape dots as well.
Textpad's POSIX regexes are good, but even better results could be achieved by installing the Win GNU util grep and adding a cmd /c "Prompt for parameters " , "Capture output" command: thus you could have full Find in files with even Perl regexes:
grep -nhPr "CoolRegexToSearchWith" C:\MyDir\ToSearchRecursivly