aboutsummaryrefslogtreecommitdiffstats
path: root/examples/CMakeLists.txt
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-05-19 15:15:20 +0100
committerYann Herklotz <ymherklotz@gmail.com>2018-05-19 15:15:20 +0100
commita8de6cb5593e3d6347393eb4c144c9cc22a470d8 (patch)
treec92063014bb76356acd09a2231e81aa084c49266 /examples/CMakeLists.txt
parent6985227db75f6adfeba880926e6629bf17b00ee8 (diff)
downloadYAGE-a8de6cb5593e3d6347393eb4c144c9cc22a470d8.tar.gz
YAGE-a8de6cb5593e3d6347393eb4c144c9cc22a470d8.zip
Moving resources and generalising examples
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()