1/****************************************************************************
2**
3** Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
4** file Copyright.txt or https://cmake.org/licensing for details.
5**
6****************************************************************************/
7
8// constructor
9function Component()
10{
11    installer.valueChanged.connect( this, Component.prototype.reactOnTargetDirChange );
12    // set the default values to CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR
13    Component.prototype.reactOnTargetDirChange("TargetDir", installer.value("TargetDir"));
14}
15
16Component.prototype.reactOnTargetDirChange = function(key, value)
17{
18    if (key == "TargetDir") {
19        var path = value + "/%CMAKE_BIN_DIR%";
20        installer.setValue("CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR", path.replace(/\\/g, "/"));
21    }
22}
23
24Component.prototype.createOperations = function()
25{
26    component.createOperations();
27
28    try {
29        if (installer.value("SDKToolBinary") == "")
30            return;
31
32        var cmId = component.name;
33        installer.setValue("CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_ID", cmId);
34
35        component.addOperation("Execute",
36                               ["{0,2}", "@SDKToolBinary@", "addCMake",
37                                "--id", cmId,
38                                "--name", "%CMake_IFW_ROOT_COMPONENT_DISPLAY_NAME%",
39                                "--path", "@CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR@/cmake%CMAKE_EXECUTABLE_SUFFIX%",
40                                "UNDOEXECUTE",
41                                "@SDKToolBinary@", "rmCMake", "--id", cmId]);
42
43    } catch( e ) {
44        print( e );
45    }
46}
47