1 #include "cmCPluginAPI.h"
14 /* do almost everything in the initial pass */
15 static int InitialPass(void *inf
, void *mf
, int argc
, char *argv
[])
22 cmLoadedCommandInfo
*info
= (cmLoadedCommandInfo
*)inf
;
24 cmVTKWrapTclData
*cdata
=
25 (cmVTKWrapTclData
*)malloc(sizeof(cmVTKWrapTclData
));
26 cdata
->LibraryName
= "BOO";
29 info
->CAPI
->SetClientData(info
,cdata
);
31 /* Now check and see if the value has been stored in the cache */
32 /* already, if so use that value and don't look for the program */
33 if(!info
->CAPI
->IsOn(mf
,"TEST_COMMAND_TEST1"))
35 info
->CAPI
->AddDefinition(mf
, "TEST_DEF", "HOO");
39 info
->CAPI
->AddDefinition(mf
, "TEST_DEF", "HOO");
40 cdata
->LibraryName
= "HOO";
42 info
->CAPI
->AddCacheDefinition(mf
, "SOME_CACHE_VARIABLE", "ON",
43 "Test cache variable",
45 info
->CAPI
->AddCacheDefinition(mf
, "SOME_CACHE_VARIABLE1", "",
46 "Test cache variable 1",
48 info
->CAPI
->AddCacheDefinition(mf
, "SOME_CACHE_VARIABLE2", "",
49 "Test cache variable 2",
51 info
->CAPI
->AddCacheDefinition(mf
, "SOME_CACHE_VARIABLE3", "",
52 "Test cache variable 3",
54 info
->CAPI
->AddCacheDefinition(mf
, "SOME_CACHE_VARIABLE4", "",
55 "Test cache variable 4",
57 info
->CAPI
->AddCacheDefinition(mf
, "SOME_CACHE_VARIABLE5", "",
58 "Test cache variable 5",
62 file
= info
->CAPI
->ExpandVariablesInString(mf
, "${CMAKE_COMMAND}", 0, 0);
64 str
= info
->CAPI
->GetFilenameWithoutExtension(file
);
65 info
->CAPI
->DisplaySatus(mf
, str
);
66 info
->CAPI
->Free(str
);
67 str
= info
->CAPI
->GetFilenamePath(file
);
68 info
->CAPI
->DisplaySatus(mf
, str
);
69 info
->CAPI
->Free(str
);
70 str
= info
->CAPI
->Capitalized("cmake");
71 info
->CAPI
->DisplaySatus(mf
, str
);
72 info
->CAPI
->Free(str
);
74 info
->CAPI
->Free(file
);
76 info
->CAPI
->DisplaySatus(mf
, info
->CAPI
->GetProjectName(mf
));
77 info
->CAPI
->DisplaySatus(mf
, info
->CAPI
->GetHomeDirectory(mf
));
78 info
->CAPI
->DisplaySatus(mf
, info
->CAPI
->GetHomeOutputDirectory(mf
));
79 info
->CAPI
->DisplaySatus(mf
, info
->CAPI
->GetStartDirectory(mf
));
80 info
->CAPI
->DisplaySatus(mf
, info
->CAPI
->GetStartOutputDirectory(mf
));
81 info
->CAPI
->DisplaySatus(mf
, info
->CAPI
->GetCurrentDirectory(mf
));
82 info
->CAPI
->DisplaySatus(mf
, info
->CAPI
->GetCurrentOutputDirectory(mf
));
83 sprintf(buffer
, "Cache version: %d.%d, CMake version: %d.%d",
84 info
->CAPI
->GetCacheMajorVersion(mf
),
85 info
->CAPI
->GetCacheMinorVersion(mf
),
86 info
->CAPI
->GetMajorVersion(mf
),
87 info
->CAPI
->GetMinorVersion(mf
));
88 info
->CAPI
->DisplaySatus(mf
, buffer
);
89 if ( info
->CAPI
->CommandExists(mf
, "SET") )
91 info
->CAPI
->DisplaySatus(mf
, "Command SET exists");
93 if ( info
->CAPI
->CommandExists(mf
, "SET_FOO_BAR") )
95 info
->CAPI
->SetError(mf
, "Command SET_FOO_BAR should not exists");
98 info
->CAPI
->AddDefineFlag(mf
, "-DADDED_DEFINITION");
100 source_file
= info
->CAPI
->CreateSourceFile();
101 cstr
= info
->CAPI
->SourceFileGetSourceName(source_file
);
102 sprintf(buffer
, "Shold be empty (source file name): [%s]", cstr
);
103 info
->CAPI
->DisplaySatus(mf
, buffer
);
104 cstr
= info
->CAPI
->SourceFileGetFullPath(source_file
);
105 sprintf(buffer
, "Shold be empty (source file full path): [%s]", cstr
);
106 info
->CAPI
->DisplaySatus(mf
, buffer
);
107 if ( info
->CAPI
->SourceFileGetPropertyAsBool(source_file
, "SOME_PROPERTY") )
109 info
->CAPI
->SetError(mf
, "Property SOME_PROPERTY should not be defined");
112 cstr
= info
->CAPI
->SourceFileGetProperty(source_file
, "ABSTRACT");
113 sprintf(buffer
, "Shold be 0 (source file abstract property): [%p]", cstr
);
114 info
->CAPI
->DisplaySatus(mf
, buffer
);
116 info
->CAPI
->DestroySourceFile(source_file
);
121 static void FinalPass(void *inf
, void *mf
)
123 cmLoadedCommandInfo
*info
= (cmLoadedCommandInfo
*)inf
;
124 /* get our client data from initial pass */
125 cmVTKWrapTclData
*cdata
=
126 (cmVTKWrapTclData
*)info
->CAPI
->GetClientData(info
);
127 if (strcmp(info
->CAPI
->GetDefinition(mf
, "TEST_DEF"),"HOO") ||
128 strcmp(cdata
->LibraryName
,"HOO"))
130 fprintf(stderr
,"*** Failed LOADED COMMAND Final Pass\n");
134 static void Destructor(void *inf
)
136 cmLoadedCommandInfo
*info
= (cmLoadedCommandInfo
*)inf
;
137 /* get our client data from initial pass */
138 cmVTKWrapTclData
*cdata
=
139 (cmVTKWrapTclData
*)info
->CAPI
->GetClientData(info
);
143 #ifdef MUCHO_MUDSLIDE
144 void CM_PLUGIN_EXPORT
CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo
*info
)
146 info
->InitialPass
= InitialPass
;
147 info
->FinalPass
= FinalPass
;
148 info
->Destructor
= Destructor
;
149 info
->m_Inherited
= 0;
150 info
->Name
= "CMAKE_TEST_COMMAND";