Imported Upstream version 2.8.10.2
[platform/upstream/cmake.git] / Modules / CTestUseLaunchers.cmake
1 # - Set the RULE_LAUNCH_* global properties when CTEST_USE_LAUNCHERS is on.
2 # CTestUseLaunchers is automatically included when you include(CTest).
3 # However, it is split out into its own module file so projects
4 # can use the CTEST_USE_LAUNCHERS functionality independently.
5 #
6 # To use launchers, set CTEST_USE_LAUNCHERS to ON in a ctest -S
7 # dashboard script, and then also set it in the cache of the configured
8 # project. Both cmake and ctest need to know the value of it for the launchers
9 # to work properly. CMake needs to know in order to generate proper build
10 # rules, and ctest, in order to produce the proper error and warning
11 # analysis.
12 #
13 # For convenience, you may set the ENV variable CTEST_USE_LAUNCHERS_DEFAULT
14 # in your ctest -S script, too. Then, as long as your CMakeLists uses
15 # include(CTest) or include(CTestUseLaunchers), it will use the value of the
16 # ENV variable to initialize a CTEST_USE_LAUNCHERS cache variable. This cache
17 # variable initialization only occurs if CTEST_USE_LAUNCHERS is not already
18 # defined.
19
20 #=============================================================================
21 # Copyright 2008-2012 Kitware, Inc.
22 #
23 # Distributed under the OSI-approved BSD License (the "License");
24 # see accompanying file Copyright.txt for details.
25 #
26 # This software is distributed WITHOUT ANY WARRANTY; without even the
27 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
28 # See the License for more information.
29 #=============================================================================
30 # (To distribute this file outside of CMake, substitute the full
31 #  License text for the above reference.)
32
33 if(NOT DEFINED CTEST_USE_LAUNCHERS AND DEFINED ENV{CTEST_USE_LAUNCHERS_DEFAULT})
34   set(CTEST_USE_LAUNCHERS "$ENV{CTEST_USE_LAUNCHERS_DEFAULT}"
35     CACHE INTERNAL "CTEST_USE_LAUNCHERS initial value from ENV")
36 endif()
37
38 if(NOT "${CMAKE_GENERATOR}" MATCHES "Make")
39   set(CTEST_USE_LAUNCHERS 0)
40 endif()
41
42 if(CTEST_USE_LAUNCHERS)
43   set(CTEST_LAUNCH_COMPILE "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <OBJECT> --source <SOURCE> --language <LANGUAGE> --")
44   set(CTEST_LAUNCH_LINK    "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <TARGET> --target-type <TARGET_TYPE> --language <LANGUAGE> --")
45   set(CTEST_LAUNCH_CUSTOM  "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <OUTPUT> --")
46   set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CTEST_LAUNCH_COMPILE}")
47   set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CTEST_LAUNCH_LINK}")
48   set_property(GLOBAL PROPERTY RULE_LAUNCH_CUSTOM "${CTEST_LAUNCH_CUSTOM}")
49 endif()