diff options
Diffstat (limited to 'linden/indra/cmake/AddPackageTarget.cmake')
-rw-r--r-- | linden/indra/cmake/AddPackageTarget.cmake | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/linden/indra/cmake/AddPackageTarget.cmake b/linden/indra/cmake/AddPackageTarget.cmake new file mode 100644 index 0000000..66adf3e --- /dev/null +++ b/linden/indra/cmake/AddPackageTarget.cmake | |||
@@ -0,0 +1,32 @@ | |||
1 | # This function adds a custom target named 'package', which runs | ||
2 | # scripts/package.py to create an installer package. | ||
3 | # | ||
4 | # By default, you must manually build the 'package' target when you | ||
5 | # are ready to create the installer package. But if the global | ||
6 | # AUTOPACKAGE variable is ON ("cmake -D AUTOPACKAGE:BOOL=ON"), the | ||
7 | # 'package' target will be added to the default build target. | ||
8 | |||
9 | |||
10 | set(AUTOPACKAGE OFF CACHE BOOL | ||
11 | "Automatically build an installer package after compiling.") | ||
12 | |||
13 | |||
14 | function( add_package_target ) | ||
15 | |||
16 | if (AUTOPACKAGE) | ||
17 | add_custom_target(package ALL) | ||
18 | else (AUTOPACKAGE) | ||
19 | add_custom_target(package) | ||
20 | endif (AUTOPACKAGE) | ||
21 | |||
22 | add_custom_command( | ||
23 | TARGET package POST_BUILD | ||
24 | COMMAND | ||
25 | ${PYTHON_EXECUTABLE} | ||
26 | ${SCRIPTS_DIR}/package.py | ||
27 | --build-dir=${CMAKE_BINARY_DIR} | ||
28 | --build-type=${CMAKE_BUILD_TYPE} | ||
29 | --source-dir=${CMAKE_SOURCE_DIR} | ||
30 | ) | ||
31 | |||
32 | endfunction( add_package_target ) | ||