Improve REGEX to detects tests files.
authorRomain Forlot <romain.forlot@iot.bzh>
Tue, 18 Apr 2017 18:32:43 +0000 (20:32 +0200)
committerRomain Forlot <romain.forlot@iot.bzh>
Tue, 18 Apr 2017 18:32:43 +0000 (20:32 +0200)
Miss a flag to set regex case-insensitiven, or I did not find it.

Change-Id: I3b743e040e57d80e4f97490feba379533387cf87
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
CAN-binder/CMakeLists.txt

index ec91089..b6c51eb 100644 (file)
@@ -54,11 +54,17 @@ endmacro(fill_include_dir)
 
 # Helper function to retrieve source files from a library repo.
 function(find_source_files path)
-       file(GLOB_RECURSE filelist "${path}/*.[cpx]")
-       foreach(filename ${filelist})
-               if(NOT ${filename} MATCHES ".*(test|example|sample).*")
+       file(GLOB_RECURSE cfiles "${path}/*.[c]")
+       file(GLOB_RECURSE cppfiles "${path}/*.cpp")
+       foreach(filename ${cfiles})
+               if(NOT ${filename} MATCHES ".*([Tt]est|[Ee]xample|[Ss]ample).*")
                        string(APPEND sources "${filename};")
-               endif(NOT ${filename} MATCHES ".*(test|example|sample).*")
+               endif(NOT ${filename} MATCHES ".*([Tt]est|[Ee]xample|[Ss]ample).*")
+       endforeach()
+       foreach(filename ${cppfiles})
+               if(NOT ${filename} MATCHES ".*([Tt]est|[Ee]xample|[Ss]ample).*")
+                       string(APPEND sources "${filename};")
+               endif(NOT ${filename} MATCHES ".*([Tt]est|[Ee]xample|[Ss]ample).*")
        endforeach()
        set(sources_files ${sources} PARENT_SCOPE)
 endfunction(find_source_files)