Browse Source
Add ccommand for executing commands on the system, so by using ADD_CUSTOM_COMMAND, you can make rules to do some system commands during build. Currently supported commands are copy and remove. Others will follow.
pull/1/head
Add ccommand for executing commands on the system, so by using ADD_CUSTOM_COMMAND, you can make rules to do some system commands during build. Currently supported commands are copy and remove. Others will follow.
pull/1/head

5 changed files with 207 additions and 0 deletions
-
2Source/CMakeLists.txt
-
18Source/CMakeSetup.dsw
-
61Source/ccommand.cxx
-
109Source/ccommand.dsp
-
17Source/cmake.cxx
@ -0,0 +1,61 @@ |
|||
/*=========================================================================
|
|||
|
|||
Program: Insight Segmentation & Registration Toolkit |
|||
Module: $RCSfile$ |
|||
Language: C++ |
|||
Date: $Date$ |
|||
Version: $Revision$ |
|||
|
|||
Copyright (c) 2002 Insight Consortium. All rights reserved. |
|||
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
|
|||
|
|||
This software is distributed WITHOUT ANY WARRANTY; without even |
|||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|||
PURPOSE. See the above copyright notices for more information. |
|||
|
|||
=========================================================================*/ |
|||
|
|||
#include "cmMakefile.h"
|
|||
#include "cmSystemTools.h"
|
|||
|
|||
void CMakeCommandUsage(const char* program) |
|||
{ |
|||
std::strstream errorStream; |
|||
|
|||
errorStream << "cmake version " << cmMakefile::GetMajorVersion() |
|||
<< "." << cmMakefile::GetMinorVersion() << "\n"; |
|||
errorStream << "Usage: " << program << " [command] [arguments ...]\n" |
|||
<< " Available commands: \n" |
|||
<< " copy file1 file2 - copy first file to the second one\n" |
|||
<< " remove file1 file2 ... - remove the file(s)\n"; |
|||
errorStream << std::ends; |
|||
cmSystemTools::Error(errorStream.str()); |
|||
} |
|||
|
|||
int main(int ac, char** av) |
|||
{ |
|||
std::vector<std::string> args; |
|||
for(int i =0; i < ac; ++i) |
|||
{ |
|||
args.push_back(av[i]); |
|||
} |
|||
|
|||
if ( args.size() > 1 ) |
|||
{ |
|||
if ( args[1] == "copy" && args.size() == 4 ) |
|||
{ |
|||
cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str()); |
|||
return 0; |
|||
} |
|||
if ( args[1] == "remove" && args.size() > 2 ) |
|||
{ |
|||
for ( int cc = 2; cc < args.size(); cc ++ ) |
|||
{ |
|||
cmSystemTools::RemoveFile(args[cc].c_str()); |
|||
} |
|||
return 0; |
|||
} |
|||
} |
|||
::CMakeCommandUsage(args[0].c_str()); |
|||
return 1; |
|||
} |
@ -0,0 +1,109 @@ |
|||
# Microsoft Developer Studio Project File - Name="ccommand" - Package Owner=<4> |
|||
# Microsoft Developer Studio Generated Build File, Format Version 6.00 |
|||
# ** DO NOT EDIT ** |
|||
|
|||
# TARGTYPE "Win32 (x86) Console Application" 0x0103 |
|||
|
|||
CFG=ccommand - Win32 Debug |
|||
!MESSAGE This is not a valid makefile. To build this project using NMAKE, |
|||
!MESSAGE use the Export Makefile command and run |
|||
!MESSAGE |
|||
!MESSAGE NMAKE /f "ccommand.mak". |
|||
!MESSAGE |
|||
!MESSAGE You can specify a configuration when running NMAKE |
|||
!MESSAGE by defining the macro CFG on the command line. For example: |
|||
!MESSAGE |
|||
!MESSAGE NMAKE /f "ccommand.mak" CFG="ccommand - Win32 Debug" |
|||
!MESSAGE |
|||
!MESSAGE Possible choices for configuration are: |
|||
!MESSAGE |
|||
!MESSAGE "ccommand - Win32 Release" (based on "Win32 (x86) Console Application") |
|||
!MESSAGE "ccommand - Win32 Debug" (based on "Win32 (x86) Console Application") |
|||
!MESSAGE |
|||
|
|||
# Begin Project |
|||
# PROP AllowPerConfigDependencies 0 |
|||
# PROP Scc_ProjName "" |
|||
# PROP Scc_LocalPath "" |
|||
CPP=cl.exe |
|||
RSC=rc.exe |
|||
|
|||
!IF "$(CFG)" == "ccommand - Win32 Release" |
|||
|
|||
# PROP BASE Use_MFC 0 |
|||
# PROP BASE Use_Debug_Libraries 0 |
|||
# PROP BASE Output_Dir "Release" |
|||
# PROP BASE Intermediate_Dir "Release" |
|||
# PROP BASE Target_Dir "" |
|||
# PROP Use_MFC 0 |
|||
# PROP Use_Debug_Libraries 0 |
|||
# PROP Output_Dir "Release" |
|||
# PROP Intermediate_Dir "Release" |
|||
# PROP Target_Dir "" |
|||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c |
|||
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c |
|||
# SUBTRACT CPP /YX |
|||
# ADD BASE RSC /l 0x409 /d "NDEBUG" |
|||
# ADD RSC /l 0x409 /d "NDEBUG" |
|||
BSC32=bscmake.exe |
|||
# ADD BASE BSC32 /nologo |
|||
# ADD BSC32 /nologo |
|||
LINK32=link.exe |
|||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 |
|||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:"ccommand.pdb" /machine:I386 /out:"ccommand.exe" |
|||
# SUBTRACT LINK32 /pdb:none |
|||
|
|||
!ELSEIF "$(CFG)" == "ccommand - Win32 Debug" |
|||
|
|||
# PROP BASE Use_MFC 0 |
|||
# PROP BASE Use_Debug_Libraries 1 |
|||
# PROP BASE Output_Dir "ccommand___Win32_Debug" |
|||
# PROP BASE Intermediate_Dir "ccommand___Win32_Debug" |
|||
# PROP BASE Target_Dir "" |
|||
# PROP Use_MFC 0 |
|||
# PROP Use_Debug_Libraries 1 |
|||
# PROP Output_Dir "ccommand___Win32_Debug" |
|||
# PROP Intermediate_Dir "ccommand___Win32_Debug" |
|||
# PROP Ignore_Export_Lib 0 |
|||
# PROP Target_Dir "" |
|||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c |
|||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c |
|||
# SUBTRACT CPP /YX |
|||
# ADD BASE RSC /l 0x409 /d "_DEBUG" |
|||
# ADD RSC /l 0x409 /d "_DEBUG" |
|||
BSC32=bscmake.exe |
|||
# ADD BASE BSC32 /nologo |
|||
# ADD BSC32 /nologo |
|||
LINK32=link.exe |
|||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
|||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:"ccommand.pdb" /debug /machine:I386 /out:"ccommand.exe" /pdbtype:sept |
|||
# SUBTRACT LINK32 /pdb:none |
|||
|
|||
!ENDIF |
|||
|
|||
# Begin Target |
|||
|
|||
# Name "ccommand - Win32 Release" |
|||
# Name "ccommand - Win32 Debug" |
|||
# Begin Group "Source Files" |
|||
|
|||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" |
|||
# Begin Source File |
|||
|
|||
SOURCE=.\ccommand.cxx |
|||
# End Source File |
|||
# End Group |
|||
# Begin Group "Header Files" |
|||
|
|||
# PROP Default_Filter "h;hpp;hxx;hm;inl" |
|||
# Begin Source File |
|||
|
|||
SOURCE=.\ccommand.h |
|||
# End Source File |
|||
# End Group |
|||
# Begin Group "Resource Files" |
|||
|
|||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" |
|||
# End Group |
|||
# End Target |
|||
# End Project |
Write
Preview
Loading…
Cancel
Save
Reference in new issue