aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2007-12-21 09:30:32 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2007-12-21 09:30:32 +0000
commita316cd8a76e13927038cad67cdc436fb32921839 (patch)
tree2c49c0122bd2a63c676f3a9b1d63fc0b200bfe69 /doc/snippets/CMakeLists.txt
parentee3410f79a05ada2f508e1cb96bf4896ba369d6c (diff)
now cmake takes snippets of code, completes them into compilable sources, builds them,
executes them and stores their output in files.
Diffstat (limited to 'doc/snippets/CMakeLists.txt')
-rw-r--r--doc/snippets/CMakeLists.txt26
1 files changed, 16 insertions, 10 deletions
diff --git a/doc/snippets/CMakeLists.txt b/doc/snippets/CMakeLists.txt
index b0d342a40..85503e03d 100644
--- a/doc/snippets/CMakeLists.txt
+++ b/doc/snippets/CMakeLists.txt
@@ -1,14 +1,20 @@
-FILE(GLOB examples_SRCS "*.cpp")
+FILE(GLOB snippets_SRCS "*.cpp")
-FOREACH(example_src ${examples_SRCS})
-GET_FILENAME_COMPONENT(example ${example_src} NAME_WE)
-ADD_EXECUTABLE(${example} ${example_src})
-GET_TARGET_PROPERTY(example_executable ${example} LOCATION)
+FOREACH(snippet_src ${snippets_SRCS})
+GET_FILENAME_COMPONENT(snippet ${snippet_src} NAME_WE)
+SET(compile_snippet_target compile_${snippet})
+SET(compile_snippet_src ${compile_snippet_target}.cpp)
+FILE(READ ${snippet_src} snippet_source_code)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
+ADD_EXECUTABLE(${compile_snippet_target}
+ ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
+GET_TARGET_PROPERTY(compile_snippet_executable
+ ${compile_snippet_target} LOCATION)
ADD_CUSTOM_COMMAND(
- TARGET ${example}
+ TARGET ${compile_snippet_target}
POST_BUILD
- COMMAND ${example_executable}
- ARGS >${CMAKE_CURRENT_BINARY_DIR}/${example}.out
+ COMMAND ${compile_snippet_executable}
+ ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out
)
-MESSAGE(coucou)
-ENDFOREACH(example_src)
+ENDFOREACH(snippet_src)