Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cMake SOURCE_GROUP multiple files?

for a VisualStudio project, i'd like cMake to put all files from a specific folder into a specific filter.

I tried:

SOURCE_GROUP(Math FILES 
    ${CMAKE_CURRENT_SOURCE_DIR}/src/Math/*.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/src/Math/*.h
)

however, this will place only the first found cpp and the first found h file into that filter. the rest of the files in the folder will be placed in the default Filters

How to do it properly?

like image 947
Mat Avatar asked Mar 14 '12 11:03

Mat


1 Answers

You need to pass full names, not globbing expressions:

FILE(GLOB source_files
    ${CMAKE_CURRENT_SOURCE_DIR}/src/Math/*.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/src/Math/*.h
)

SOURCE_GROUP(Math FILES ${source_files})
like image 164
Andrey Kamaev Avatar answered Nov 08 '22 00:11

Andrey Kamaev