2 message(FATAL_ERROR "Pass -Dversion=")
5 # Name of the archive and its top-level directory.
6 set(archive_name "cmake-${version}-tutorial-source")
8 # Base directory for CMake Documentation.
9 set(help_dir "${CMAKE_CURRENT_LIST_DIR}/../../Help")
10 cmake_path(ABSOLUTE_PATH help_dir NORMALIZE)
12 # Collect the non-documentation part of the tutorial directory.
13 file(COPY "${help_dir}/guide/tutorial/"
14 DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${archive_name}"
17 PATTERN source.txt EXCLUDE
19 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${archive_name}/README.txt" [[
20 This directory contains source code examples for the CMake Tutorial.
21 Each step has its own subdirectory containing code that may be used as a
22 starting point. The tutorial examples are progressive so that each step
23 provides the complete solution for the previous step.
26 # Create an archive containing the tutorial source examples.
27 file(MAKE_DIRECTORY "${help_dir}/_generated")
29 OUTPUT "${help_dir}/_generated/${archive_name}.zip"
30 PATHS "${CMAKE_CURRENT_BINARY_DIR}/${archive_name}"
34 # Write a reStructuredText snippet included from the tutorial index.
35 file(WRITE "${help_dir}/guide/tutorial/source.txt" "
36 .. |tutorial_source| replace::
37 The tutorial source code examples are available in
38 :download:`this archive </_generated/${archive_name}.zip>`.
41 # Remove temporary directory.
42 file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/${archive_name}")