File tree Expand file tree Collapse file tree 4 files changed +493
-196
lines changed Expand file tree Collapse file tree 4 files changed +493
-196
lines changed Original file line number Diff line number Diff line change @@ -103,9 +103,14 @@ else()
103
103
endif ()
104
104
105
105
106
- # Provides list of source files in STK_SOURCES
106
+ # Provides list of source and header files ( STK_SOURCES and STK_HEADERS)
107
107
include (sources .cmake )
108
108
109
+ # Generate source groups useful for MSVC project explorer
110
+ include (cmake/SourceGroupFunctions.cmake )
111
+ source_group_hierarchy (STK_SOURCES STK_HEADERS )
112
+
113
+
109
114
if (APPLE )
110
115
# icon files to copy in the bundle
111
116
set (OSX_ICON_FILES ${PROJECT_SOURCE_DIR} /src/ide/Xcode/stk.icns )
@@ -138,7 +143,7 @@ else()
138
143
add_definitions (-DSUPERTUXKART_DATADIR=\" ${CMAKE_INSTALL_PREFIX} /share/games/supertuxkart\" )
139
144
140
145
# Build the final executable
141
- add_executable (supertuxkart ${STK_SOURCES} )
146
+ add_executable (supertuxkart ${STK_SOURCES} ${STK_HEADERS} )
142
147
if (CYGWIN )
143
148
target_link_libraries (supertuxkart pthread )
144
149
elseif (UNIX )
Original file line number Diff line number Diff line change
1
+ # Generate source groups which mimic the original folder hierarchy.
2
+ # This is mainly useful for MSVC's project explorer
3
+ # - SRCS list of source files
4
+ # - HDRS list of header files
5
+ function (source_group_hierarchy SRCS HDRS )
6
+ foreach (source_file ${${SRCS}} )
7
+ source_group_file (${source_file} "Source Files\\ " )
8
+ endforeach ()
9
+
10
+ foreach (header_file ${${HDRS}} )
11
+ source_group_file (${header_file} "Header Files\\ " )
12
+ endforeach ()
13
+ endfunction ()
14
+
15
+ # Determine source_group depending on file path
16
+ # - FILE path to a file (header or source)
17
+ # - GROUP_PREFIX prefix for group name
18
+ function (source_group_file file group_prefix )
19
+ get_filename_component (file_path ${file} PATH )
20
+ if (${file_path} STREQUAL "src" )
21
+ source_group ("${group_prefix} " FILES ${file} )
22
+ else ()
23
+ string (REGEX REPLACE "^src/(.*)$" "\\ 1" group_name ${file_path} )
24
+ string (REPLACE "/" "\\\\ " group_name ${group_name} )
25
+ source_group ("${group_prefix}${group_name} " FILES ${file} )
26
+ endif ()
27
+ endfunction ()
You can’t perform that action at this time.
0 commit comments