3 # We need ansi C support, otherwise it doesn't build e.g. on HP-UX:
4 # main.c", line 3: error 1705: Function prototypes are an ANSI feature.
6 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
7 ENDIF(CMAKE_ANSI_CFLAGS)
10 # this is not really a test which can fail
11 # it is more an example with several source_group()
13 # The created projects have to be loaded manually
14 # in Visual Studio/XCode/Eclipse/...
15 # to see whether the correct groups have been created.
17 source_group(Base FILES main.c)
20 source_group(Base\\Sub1 FILES sub1/foo.c)
23 source_group(Base\\Sub1\\Sub2 FILES sub1/foobar.c)
25 # a group with empty name
26 source_group("" FILES foo.c)
28 # a group, whose name consists only of the delimiter
29 #should be handled the same way as an empty name
30 source_group("\\" FILES baz.c)
32 # a sub sub group whose last component has the same name
33 # as an already existing group
34 source_group(Base\\Sub1\\Base FILES bar.c)
36 # a group without files, is currently not created
37 source_group(EmptyGroup)
40 add_executable(SourceGroups main.c bar.c foo.c sub1/foo.c sub1/foobar.c baz.c)