aboutsummaryrefslogtreecommitdiffstats
path: root/examples/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'examples/CMakeLists.txt')
-rw-r--r--examples/CMakeLists.txt22
1 files changed, 17 insertions, 5 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 156b6a34..ec4c71e2 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,10 +1,22 @@
-function(make_example name)
-
+macro(make_example name)
file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${name}/*.cpp)
add_executable(${name} ${SOURCES})
target_link_libraries(${name} yage)
+endmacro(make_example)
+
+macro(subdirlist result curdir)
+ file(GLOB children RELATIVE ${curdir} ${curdir}/*)
+ set(dirlist "")
+ foreach(child ${children})
+ if(IS_DIRECTORY ${curdir}/${child})
+ list(APPEND dirlist ${child})
+ endif()
+ endforeach()
+ set(${result} ${dirlist})
+endmacro()
-endfunction(make_example)
+subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})
-make_example(simplegame)
-make_example(shooter)
+foreach(subdir ${SUBDIRS})
+ make_example(${subdir})
+endforeach()