From 658614ff6a14411e2a697fac1f1717a7f4370bf0 Mon Sep 17 00:00:00 2001 From: Will Schroeder Date: Thu, 18 Jan 2001 11:20:24 -0500 Subject: ENH:Reworked CMake for consistency --- CMakeCommands.make.in | 42 +++++++++ CMakeMaster.make.in | 2 +- CMakeRules.make.in | 42 --------- CMakeSimpleCommands.make.in | 15 ++++ CMakeSimpleRules.make.in | 15 ---- Source/CMakeSetupCMD.dsp | 80 ++++++++--------- Source/MFCDialog/CMakeSetup.dsp | 82 +++++++++--------- Source/Makefile.in | 84 +++++++++--------- Source/cmAbstractFilesCommand.cxx | 41 +++++++++ Source/cmAbstractFilesCommand.h | 61 +++++++++++++ Source/cmAbstractFilesRule.cxx | 41 --------- Source/cmAbstractFilesRule.h | 67 -------------- Source/cmAddTargetCommand.cxx | 34 ++++++++ Source/cmAddTargetCommand.h | 70 +++++++++++++++ Source/cmAddTargetRule.cxx | 34 -------- Source/cmAddTargetRule.h | 76 ---------------- Source/cmAuxSourceDirectoryCommand.cxx | 61 +++++++++++++ Source/cmAuxSourceDirectoryCommand.h | 74 ++++++++++++++++ Source/cmAuxSourceDirectoryRule.cxx | 61 ------------- Source/cmAuxSourceDirectoryRule.h | 80 ----------------- Source/cmCommand.h | 138 +++++++++++++++++++++++++++++ Source/cmDumpDocumentation.cxx | 2 +- Source/cmExecutablesCommand.cxx | 35 ++++++++ Source/cmExecutablesCommand.h | 69 +++++++++++++++ Source/cmExecutablesRule.cxx | 35 -------- Source/cmExecutablesRule.h | 75 ---------------- Source/cmFindIncludeCommand.cxx | 33 +++++++ Source/cmFindIncludeCommand.h | 77 +++++++++++++++++ Source/cmFindIncludeRule.cxx | 33 ------- Source/cmFindIncludeRule.h | 83 ------------------ Source/cmFindLibraryCommand.cxx | 33 +++++++ Source/cmFindLibraryCommand.h | 78 +++++++++++++++++ Source/cmFindLibraryRule.cxx | 33 ------- Source/cmFindLibraryRule.h | 84 ------------------ Source/cmFindProgramCommand.cxx | 80 +++++++++++++++++ Source/cmFindProgramCommand.h | 78 +++++++++++++++++ Source/cmFindProgramRule.cxx | 80 ----------------- Source/cmFindProgramRule.h | 84 ------------------ Source/cmIncludeDirectoryCommand.cxx | 33 +++++++ Source/cmIncludeDirectoryCommand.h | 76 ++++++++++++++++ Source/cmIncludeDirectoryRule.cxx | 33 ------- Source/cmIncludeDirectoryRule.h | 82 ------------------ Source/cmLibraryCommand.cxx | 29 +++++++ Source/cmLibraryCommand.h | 71 +++++++++++++++ Source/cmLibraryRule.cxx | 29 ------- Source/cmLibraryRule.h | 77 ----------------- Source/cmLinkDirectoriesCommand.cxx | 33 +++++++ Source/cmLinkDirectoriesCommand.h | 81 +++++++++++++++++ Source/cmLinkDirectoriesRule.cxx | 33 ------- Source/cmLinkDirectoriesRule.h | 87 ------------------- Source/cmLinkLibrariesCommand.cxx | 33 +++++++ Source/cmLinkLibrariesCommand.h | 83 ++++++++++++++++++ Source/cmLinkLibrariesRule.cxx | 33 ------- Source/cmLinkLibrariesRule.h | 89 ------------------- Source/cmMakefile.cxx | 154 ++++++++++++++++----------------- Source/cmMakefile.h | 22 ++--- Source/cmMakefileGenerator.h | 2 +- Source/cmProjectCommand.cxx | 29 +++++++ Source/cmProjectCommand.h | 71 +++++++++++++++ Source/cmProjectRule.cxx | 29 ------- Source/cmProjectRule.h | 77 ----------------- Source/cmRuleMaker.h | 129 --------------------------- Source/cmSourceFilesCommand.cxx | 36 ++++++++ Source/cmSourceFilesCommand.h | 75 ++++++++++++++++ Source/cmSourceFilesRequireCommand.cxx | 54 ++++++++++++ Source/cmSourceFilesRequireCommand.h | 73 ++++++++++++++++ Source/cmSourceFilesRequireRule.cxx | 54 ------------ Source/cmSourceFilesRequireRule.h | 79 ----------------- Source/cmSourceFilesRule.cxx | 36 -------- Source/cmSourceFilesRule.h | 81 ----------------- Source/cmSubdirCommand.cxx | 33 +++++++ Source/cmSubdirCommand.h | 74 ++++++++++++++++ Source/cmSubdirRule.cxx | 33 ------- Source/cmSubdirRule.h | 80 ----------------- Source/cmSystemTools.h | 2 +- Source/cmTestsCommand.cxx | 35 ++++++++ Source/cmTestsCommand.h | 74 ++++++++++++++++ Source/cmTestsRule.cxx | 35 -------- Source/cmTestsRule.h | 80 ----------------- Source/cmUnixDefinesCommand.cxx | 40 +++++++++ Source/cmUnixDefinesCommand.h | 82 ++++++++++++++++++ Source/cmUnixDefinesRule.cxx | 40 --------- Source/cmUnixDefinesRule.h | 88 ------------------- Source/cmUnixLibrariesCommand.cxx | 40 +++++++++ Source/cmUnixLibrariesCommand.h | 81 +++++++++++++++++ Source/cmUnixLibrariesRule.cxx | 40 --------- Source/cmUnixLibrariesRule.h | 87 ------------------- Source/cmWin32DefinesCommand.cxx | 40 +++++++++ Source/cmWin32DefinesCommand.h | 82 ++++++++++++++++++ Source/cmWin32DefinesRule.cxx | 40 --------- Source/cmWin32DefinesRule.h | 88 ------------------- Source/cmWin32LibrariesCommand.cxx | 41 +++++++++ Source/cmWin32LibrariesCommand.h | 81 +++++++++++++++++ Source/cmWin32LibrariesRule.cxx | 41 --------- Source/cmWin32LibrariesRule.h | 87 ------------------- 95 files changed, 2714 insertions(+), 2825 deletions(-) create mode 100644 CMakeCommands.make.in delete mode 100644 CMakeRules.make.in create mode 100644 CMakeSimpleCommands.make.in delete mode 100644 CMakeSimpleRules.make.in create mode 100644 Source/cmAbstractFilesCommand.cxx create mode 100644 Source/cmAbstractFilesCommand.h delete mode 100644 Source/cmAbstractFilesRule.cxx delete mode 100644 Source/cmAbstractFilesRule.h create mode 100644 Source/cmAddTargetCommand.cxx create mode 100644 Source/cmAddTargetCommand.h delete mode 100644 Source/cmAddTargetRule.cxx delete mode 100644 Source/cmAddTargetRule.h create mode 100644 Source/cmAuxSourceDirectoryCommand.cxx create mode 100644 Source/cmAuxSourceDirectoryCommand.h delete mode 100644 Source/cmAuxSourceDirectoryRule.cxx delete mode 100644 Source/cmAuxSourceDirectoryRule.h create mode 100644 Source/cmCommand.h create mode 100644 Source/cmExecutablesCommand.cxx create mode 100644 Source/cmExecutablesCommand.h delete mode 100644 Source/cmExecutablesRule.cxx delete mode 100644 Source/cmExecutablesRule.h create mode 100644 Source/cmFindIncludeCommand.cxx create mode 100644 Source/cmFindIncludeCommand.h delete mode 100644 Source/cmFindIncludeRule.cxx delete mode 100644 Source/cmFindIncludeRule.h create mode 100644 Source/cmFindLibraryCommand.cxx create mode 100644 Source/cmFindLibraryCommand.h delete mode 100644 Source/cmFindLibraryRule.cxx delete mode 100644 Source/cmFindLibraryRule.h create mode 100644 Source/cmFindProgramCommand.cxx create mode 100644 Source/cmFindProgramCommand.h delete mode 100644 Source/cmFindProgramRule.cxx delete mode 100644 Source/cmFindProgramRule.h create mode 100644 Source/cmIncludeDirectoryCommand.cxx create mode 100644 Source/cmIncludeDirectoryCommand.h delete mode 100644 Source/cmIncludeDirectoryRule.cxx delete mode 100644 Source/cmIncludeDirectoryRule.h create mode 100644 Source/cmLibraryCommand.cxx create mode 100644 Source/cmLibraryCommand.h delete mode 100644 Source/cmLibraryRule.cxx delete mode 100644 Source/cmLibraryRule.h create mode 100644 Source/cmLinkDirectoriesCommand.cxx create mode 100644 Source/cmLinkDirectoriesCommand.h delete mode 100644 Source/cmLinkDirectoriesRule.cxx delete mode 100644 Source/cmLinkDirectoriesRule.h create mode 100644 Source/cmLinkLibrariesCommand.cxx create mode 100644 Source/cmLinkLibrariesCommand.h delete mode 100644 Source/cmLinkLibrariesRule.cxx delete mode 100644 Source/cmLinkLibrariesRule.h create mode 100644 Source/cmProjectCommand.cxx create mode 100644 Source/cmProjectCommand.h delete mode 100644 Source/cmProjectRule.cxx delete mode 100644 Source/cmProjectRule.h delete mode 100644 Source/cmRuleMaker.h create mode 100644 Source/cmSourceFilesCommand.cxx create mode 100644 Source/cmSourceFilesCommand.h create mode 100644 Source/cmSourceFilesRequireCommand.cxx create mode 100644 Source/cmSourceFilesRequireCommand.h delete mode 100644 Source/cmSourceFilesRequireRule.cxx delete mode 100644 Source/cmSourceFilesRequireRule.h delete mode 100644 Source/cmSourceFilesRule.cxx delete mode 100644 Source/cmSourceFilesRule.h create mode 100644 Source/cmSubdirCommand.cxx create mode 100644 Source/cmSubdirCommand.h delete mode 100644 Source/cmSubdirRule.cxx delete mode 100644 Source/cmSubdirRule.h create mode 100644 Source/cmTestsCommand.cxx create mode 100644 Source/cmTestsCommand.h delete mode 100644 Source/cmTestsRule.cxx delete mode 100644 Source/cmTestsRule.h create mode 100644 Source/cmUnixDefinesCommand.cxx create mode 100644 Source/cmUnixDefinesCommand.h delete mode 100644 Source/cmUnixDefinesRule.cxx delete mode 100644 Source/cmUnixDefinesRule.h create mode 100644 Source/cmUnixLibrariesCommand.cxx create mode 100644 Source/cmUnixLibrariesCommand.h delete mode 100644 Source/cmUnixLibrariesRule.cxx delete mode 100644 Source/cmUnixLibrariesRule.h create mode 100644 Source/cmWin32DefinesCommand.cxx create mode 100644 Source/cmWin32DefinesCommand.h delete mode 100644 Source/cmWin32DefinesRule.cxx delete mode 100644 Source/cmWin32DefinesRule.h create mode 100644 Source/cmWin32LibrariesCommand.cxx create mode 100644 Source/cmWin32LibrariesCommand.h delete mode 100644 Source/cmWin32LibrariesRule.cxx delete mode 100644 Source/cmWin32LibrariesRule.h diff --git a/CMakeCommands.make.in b/CMakeCommands.make.in new file mode 100644 index 0000000..472121f --- /dev/null +++ b/CMakeCommands.make.in @@ -0,0 +1,42 @@ +# rules for building .o files from source files +@MAKEINCLUDE@ @MAKEQUOTE@@CMAKE_CONFIG_DIR@/CMake/CMakeSimpleCommands.make@MAKEQUOTE@ + +# +# Makefile for +# +#------------------------------------------------------------------------------ +# +all: CMakeTargets.make ${LOCAL_BUILD_TARGETS} ${BUILD_LIB_FILE} ${EXECUTABLES} ${SUBDIR_BUILD} ${CMAKE} + +#------------------------------------------------------------------------------ + +${CMAKE}: ${topdir}/CMake/Source/*.cxx ${topdir}/CMake/Source/*.h + cd ${CMAKE_CONFIG_DIR}/CMake/Source; ${MAKE} CMakeBuildTargets + +depend: ${CMAKE} ${SUBDIR_DEPEND} + ${MAKE} -${MAKEFLAGS} CMakeTargets.make + + +clean: ${SUBDIR_CLEAN} + rm -f ${SRC_OBJ} ${EXECUTABLES} + +CMakeTargets.make: ${CMAKE} ${srcdir}/CMakeLists.txt + ${CMAKE} ${srcdir}/CMakeLists.txt -S${currentdir} -H${topdir} -B${CMAKE_CONFIG_DIR} + +#------------------------------------------------------------------------------ +# rules for the normal library +# +lib${LIBRARY}.a: ${SRC_OBJ} ${KIT_OBJ} + ${AR} cr lib${LIBRARY}.a ${KIT_OBJ} + ${RANLIB} lib$(LIBRARY).a + + +lib$(LIBRARY)$(SHLIB_SUFFIX): ${KIT_OBJ} + rm -f lib$(LIBRARY)$(SHLIB_SUFFIX) + $(CXX) ${CXX_FLAGS} ${CMAKE_SHLIB_BUILD_FLAGS} -o \ + lib$(LIBRARY)$(SHLIB_SUFFIX) \ + ${KIT_OBJ} ${SHLIB_LD_LIBS} + +install: ${BUILD_LIB_FILE} + @echo "Installing ${BUILD_LIB_FILE}" + ${INSTALL} -m 755 $(BUILD_LIB_FILE) $(LIB_INSTALL_DIR)/$(BUILD_LIB_FILE) diff --git a/CMakeMaster.make.in b/CMakeMaster.make.in index 404b73a..f5dc901 100644 --- a/CMakeMaster.make.in +++ b/CMakeMaster.make.in @@ -16,6 +16,6 @@ CMAKE_LIB_EXT = @CMAKE_LIB_EXT@ #------------------------------------------------------------------------------ # Include General Build Rules -@MAKEINCLUDE@ @MAKEQUOTE@@CMAKE_CONFIG_DIR@/CMake/CMakeRules.make@MAKEQUOTE@ +@MAKEINCLUDE@ @MAKEQUOTE@@CMAKE_CONFIG_DIR@/CMake/CMakeCommands.make@MAKEQUOTE@ diff --git a/CMakeRules.make.in b/CMakeRules.make.in deleted file mode 100644 index bfecbf3..0000000 --- a/CMakeRules.make.in +++ /dev/null @@ -1,42 +0,0 @@ -# rules for building .o files from source files -@MAKEINCLUDE@ @MAKEQUOTE@@CMAKE_CONFIG_DIR@/CMake/CMakeSimpleRules.make@MAKEQUOTE@ - -# -# Makefile for -# -#------------------------------------------------------------------------------ -# -all: CMakeTargets.make ${LOCAL_BUILD_TARGETS} ${BUILD_LIB_FILE} ${EXECUTABLES} ${SUBDIR_BUILD} ${CMAKE} - -#------------------------------------------------------------------------------ - -${CMAKE}: ${topdir}/CMake/Source/*.cxx ${topdir}/CMake/Source/*.h - cd ${CMAKE_CONFIG_DIR}/CMake/Source; ${MAKE} CMakeBuildTargets - -depend: ${CMAKE} ${SUBDIR_DEPEND} - ${MAKE} -${MAKEFLAGS} CMakeTargets.make - - -clean: ${SUBDIR_CLEAN} - rm -f ${SRC_OBJ} ${EXECUTABLES} - -CMakeTargets.make: ${CMAKE} ${srcdir}/CMakeLists.txt - ${CMAKE} ${srcdir}/CMakeLists.txt -S${currentdir} -H${topdir} -B${CMAKE_CONFIG_DIR} - -#------------------------------------------------------------------------------ -# rules for the normal library -# -lib${LIBRARY}.a: ${SRC_OBJ} ${KIT_OBJ} - ${AR} cr lib${LIBRARY}.a ${KIT_OBJ} - ${RANLIB} lib$(LIBRARY).a - - -lib$(LIBRARY)$(SHLIB_SUFFIX): ${KIT_OBJ} - rm -f lib$(LIBRARY)$(SHLIB_SUFFIX) - $(CXX) ${CXX_FLAGS} ${CMAKE_SHLIB_BUILD_FLAGS} -o \ - lib$(LIBRARY)$(SHLIB_SUFFIX) \ - ${KIT_OBJ} ${SHLIB_LD_LIBS} - -install: ${BUILD_LIB_FILE} - @echo "Installing ${BUILD_LIB_FILE}" - ${INSTALL} -m 755 $(BUILD_LIB_FILE) $(LIB_INSTALL_DIR)/$(BUILD_LIB_FILE) diff --git a/CMakeSimpleCommands.make.in b/CMakeSimpleCommands.make.in new file mode 100644 index 0000000..cb95e29 --- /dev/null +++ b/CMakeSimpleCommands.make.in @@ -0,0 +1,15 @@ +# this file contains the most basic rules. This is used +# in the CMake/Source/Makefile.in to avoid infinite recursion +# in the rule for all: + +# set up make suffixes + +.SUFFIXES: .cxx .java .class + +#------------------------------------------------------------------------------ +# rules for building .o files from source files + +.c.o: + ${CC} ${CC_FLAGS} -c $< -o $@ +.cxx.o: + ${CXX} ${CXX_FLAGS} -c $< -o $@ diff --git a/CMakeSimpleRules.make.in b/CMakeSimpleRules.make.in deleted file mode 100644 index cb95e29..0000000 --- a/CMakeSimpleRules.make.in +++ /dev/null @@ -1,15 +0,0 @@ -# this file contains the most basic rules. This is used -# in the CMake/Source/Makefile.in to avoid infinite recursion -# in the rule for all: - -# set up make suffixes - -.SUFFIXES: .cxx .java .class - -#------------------------------------------------------------------------------ -# rules for building .o files from source files - -.c.o: - ${CC} ${CC_FLAGS} -c $< -o $@ -.cxx.o: - ${CXX} ${CXX_FLAGS} -c $< -o $@ diff --git a/Source/CMakeSetupCMD.dsp b/Source/CMakeSetupCMD.dsp index f24c193..244fb9e 100644 --- a/Source/CMakeSetupCMD.dsp +++ b/Source/CMakeSetupCMD.dsp @@ -91,11 +91,11 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=.\cmAbstractFilesRule.cxx +SOURCE=.\cmAbstractFilesCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmAddTargetRule.cxx +SOURCE=.\cmAddTargetCommand.cxx # End Source File # Begin Source File @@ -103,7 +103,7 @@ SOURCE=.\CMakeSetupCMD.cxx # End Source File # Begin Source File -SOURCE=.\cmAuxSourceDirectoryRule.cxx +SOURCE=.\cmAuxSourceDirectoryCommand.cxx # End Source File # Begin Source File @@ -123,35 +123,35 @@ SOURCE=.\cmDSWMakefile.cxx # End Source File # Begin Source File -SOURCE=.\cmExecutablesRule.cxx +SOURCE=.\cmExecutablesCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmFindIncludeRule.cxx +SOURCE=.\cmFindIncludeCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmFindLibraryRule.cxx +SOURCE=.\cmFindLibraryCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmFindProgramRule.cxx +SOURCE=.\cmFindProgramCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmIncludeDirectoryRule.cxx +SOURCE=.\cmIncludeDirectoryCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmLibraryRule.cxx +SOURCE=.\cmLibraryCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmLinkDirectoriesRule.cxx +SOURCE=.\cmLinkDirectoriesCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmLinkLibrariesRule.cxx +SOURCE=.\cmLinkLibrariesCommand.cxx # End Source File # Begin Source File @@ -171,7 +171,7 @@ SOURCE=.\cmMSProjectGenerator.cxx # End Source File # Begin Source File -SOURCE=.\cmProjectRule.cxx +SOURCE=.\cmProjectCommand.cxx # End Source File # Begin Source File @@ -179,15 +179,15 @@ SOURCE=.\cmRegularExpression.cxx # End Source File # Begin Source File -SOURCE=.\cmSourceFilesRequireRule.cxx +SOURCE=.\cmSourceFilesRequireCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmSourceFilesRule.cxx +SOURCE=.\cmSourceFilesCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmSubdirRule.cxx +SOURCE=.\cmSubdirCommand.cxx # End Source File # Begin Source File @@ -195,23 +195,23 @@ SOURCE=.\cmSystemTools.cxx # End Source File # Begin Source File -SOURCE=.\cmTestsRule.cxx +SOURCE=.\cmTestsCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmUnixDefinesRule.cxx +SOURCE=.\cmUnixDefinesCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmUnixLibrariesRule.cxx +SOURCE=.\cmUnixLibrariesCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmWin32DefinesRule.cxx +SOURCE=.\cmWin32DefinesCommand.cxx # End Source File # Begin Source File -SOURCE=.\cmWin32LibrariesRule.cxx +SOURCE=.\cmWin32LibrariesCommand.cxx # End Source File # Begin Source File @@ -223,15 +223,15 @@ SOURCE=.\cmWindowsConfigure.cxx # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File -SOURCE=.\cmAbstractFilesRule.h +SOURCE=.\cmAbstractFilesCommand.h # End Source File # Begin Source File -SOURCE=.\cmAddTargetRule.h +SOURCE=.\cmAddTargetCommand.h # End Source File # Begin Source File -SOURCE=.\cmAuxSourceDirectoryRule.h +SOURCE=.\cmAuxSourceDirectoryCommand.h # End Source File # Begin Source File @@ -251,35 +251,35 @@ SOURCE=.\cmDSWMakefile.h # End Source File # Begin Source File -SOURCE=.\cmExecutablesRule.h +SOURCE=.\cmExecutablesCommand.h # End Source File # Begin Source File -SOURCE=.\cmFindIncludeRule.h +SOURCE=.\cmFindIncludeCommand.h # End Source File # Begin Source File -SOURCE=.\cmFindLibraryRule.h +SOURCE=.\cmFindLibraryCommand.h # End Source File # Begin Source File -SOURCE=.\cmFindProgramRule.h +SOURCE=.\cmFindProgramCommand.h # End Source File # Begin Source File -SOURCE=.\cmIncludeDirectoryRule.h +SOURCE=.\cmIncludeDirectoryCommand.h # End Source File # Begin Source File -SOURCE=.\cmLibraryRule.h +SOURCE=.\cmLibraryCommand.h # End Source File # Begin Source File -SOURCE=.\cmLinkDirectoriesRule.h +SOURCE=.\cmLinkDirectoriesCommand.h # End Source File # Begin Source File -SOURCE=.\cmLinkLibrariesRule.h +SOURCE=.\cmLinkLibrariesCommand.h # End Source File # Begin Source File @@ -303,7 +303,7 @@ SOURCE=.\cmMSProjectGenerator.h # End Source File # Begin Source File -SOURCE=.\cmProjectRule.h +SOURCE=.\cmProjectCommand.h # End Source File # Begin Source File @@ -311,11 +311,11 @@ SOURCE=.\cmRegularExpression.h # End Source File # Begin Source File -SOURCE=.\cmRuleMaker.h +SOURCE=.\cmCommand.h # End Source File # Begin Source File -SOURCE=.\cmSourceFilesRule.h +SOURCE=.\cmSourceFilesCommand.h # End Source File # Begin Source File @@ -323,7 +323,7 @@ SOURCE=.\cmStandardIncludes.h # End Source File # Begin Source File -SOURCE=.\cmSubdirRule.h +SOURCE=.\cmSubdirCommand.h # End Source File # Begin Source File @@ -331,23 +331,23 @@ SOURCE=.\cmSystemTools.h # End Source File # Begin Source File -SOURCE=.\cmTestsRule.h +SOURCE=.\cmTestsCommand.h # End Source File # Begin Source File -SOURCE=.\cmUnixDefinesRule.h +SOURCE=.\cmUnixDefinesCommand.h # End Source File # Begin Source File -SOURCE=.\cmUnixLibrariesRule.h +SOURCE=.\cmUnixLibrariesCommand.h # End Source File # Begin Source File -SOURCE=.\cmWin32DefinesRule.h +SOURCE=.\cmWin32DefinesCommand.h # End Source File # Begin Source File -SOURCE=.\cmWin32LibrariesRule.h +SOURCE=.\cmWin32LibrariesCommand.h # End Source File # Begin Source File diff --git a/Source/MFCDialog/CMakeSetup.dsp b/Source/MFCDialog/CMakeSetup.dsp index b8dc31c..7a2dea1 100644 --- a/Source/MFCDialog/CMakeSetup.dsp +++ b/Source/MFCDialog/CMakeSetup.dsp @@ -92,11 +92,11 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=..\cmAbstractFilesRule.cxx +SOURCE=..\cmAbstractFilesCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmAddTargetRule.cxx +SOURCE=..\cmAddTargetCommand.cxx # End Source File # Begin Source File @@ -116,7 +116,7 @@ SOURCE=.\CMakeSetupDialog.cpp # End Source File # Begin Source File -SOURCE=..\cmAuxSourceDirectoryRule.cxx +SOURCE=..\cmAuxSourceDirectoryCommand.cxx # End Source File # Begin Source File @@ -136,35 +136,35 @@ SOURCE=..\cmDSWMakefile.cxx # End Source File # Begin Source File -SOURCE=..\cmExecutablesRule.cxx +SOURCE=..\cmExecutablesCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmFindIncludeRule.cxx +SOURCE=..\cmFindIncludeCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmFindLibraryRule.cxx +SOURCE=..\cmFindLibraryCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmFindProgramRule.cxx +SOURCE=..\cmFindProgramCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmIncludeDirectoryRule.cxx +SOURCE=..\cmIncludeDirectoryCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmLibraryRule.cxx +SOURCE=..\cmLibraryCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmLinkDirectoriesRule.cxx +SOURCE=..\cmLinkDirectoriesCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmLinkLibrariesRule.cxx +SOURCE=..\cmLinkLibrariesCommand.cxx # End Source File # Begin Source File @@ -184,7 +184,7 @@ SOURCE=..\cmMSProjectGenerator.cxx # End Source File # Begin Source File -SOURCE=..\cmProjectRule.cxx +SOURCE=..\cmProjectCommand.cxx # End Source File # Begin Source File @@ -192,15 +192,15 @@ SOURCE=..\cmRegularExpression.cxx # End Source File # Begin Source File -SOURCE=..\cmSourceFilesRequireRule.cxx +SOURCE=..\cmSourceFilesRequireCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmSourceFilesRule.cxx +SOURCE=..\cmSourceFilesCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmSubdirRule.cxx +SOURCE=..\cmSubdirCommand.cxx # End Source File # Begin Source File @@ -208,23 +208,23 @@ SOURCE=..\cmSystemTools.cxx # End Source File # Begin Source File -SOURCE=..\cmTestsRule.cxx +SOURCE=..\cmTestsCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmUnixDefinesRule.cxx +SOURCE=..\cmUnixDefinesCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmUnixLibrariesRule.cxx +SOURCE=..\cmUnixLibrariesCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmWin32DefinesRule.cxx +SOURCE=..\cmWin32DefinesCommand.cxx # End Source File # Begin Source File -SOURCE=..\cmWin32LibrariesRule.cxx +SOURCE=..\cmWin32LibrariesCommand.cxx # End Source File # Begin Source File @@ -241,11 +241,11 @@ SOURCE=.\StdAfx.cpp # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File -SOURCE=..\cmAbstractFilesRule.h +SOURCE=..\cmAbstractFilesCommand.h # End Source File # Begin Source File -SOURCE=..\cmAddTargetRule.h +SOURCE=..\cmAddTargetCommand.h # End Source File # Begin Source File @@ -261,7 +261,7 @@ SOURCE=.\CMakeSetupDialog.h # End Source File # Begin Source File -SOURCE=..\cmAuxSourceDirectoryRule.h +SOURCE=..\cmAuxSourceDirectoryCommand.h # End Source File # Begin Source File @@ -289,35 +289,35 @@ SOURCE=..\cmDSWMakefile.h # End Source File # Begin Source File -SOURCE=..\cmExecutablesRule.h +SOURCE=..\cmExecutablesCommand.h # End Source File # Begin Source File -SOURCE=..\cmFindIncludeRule.h +SOURCE=..\cmFindIncludeCommand.h # End Source File # Begin Source File -SOURCE=..\cmFindLibraryRule.h +SOURCE=..\cmFindLibraryCommand.h # End Source File # Begin Source File -SOURCE=..\cmFindProgramRule.h +SOURCE=..\cmFindProgramCommand.h # End Source File # Begin Source File -SOURCE=..\cmIncludeDirectoryRule.h +SOURCE=..\cmIncludeDirectoryCommand.h # End Source File # Begin Source File -SOURCE=..\cmLibraryRule.h +SOURCE=..\cmLibraryCommand.h # End Source File # Begin Source File -SOURCE=..\cmLinkDirectoriesRule.h +SOURCE=..\cmLinkDirectoriesCommand.h # End Source File # Begin Source File -SOURCE=..\cmLinkLibrariesRule.h +SOURCE=..\cmLinkLibrariesCommand.h # End Source File # Begin Source File @@ -341,7 +341,7 @@ SOURCE=..\cmMSProjectGenerator.h # End Source File # Begin Source File -SOURCE=..\cmProjectRule.h +SOURCE=..\cmProjectCommand.h # End Source File # Begin Source File @@ -349,15 +349,15 @@ SOURCE=..\cmRegularExpression.h # End Source File # Begin Source File -SOURCE=..\cmRuleMaker.h +SOURCE=..\cmCommandMaker.h # End Source File # Begin Source File -SOURCE=..\cmSourceFilesRequireRule.h +SOURCE=..\cmSourceFilesRequireCommand.h # End Source File # Begin Source File -SOURCE=..\cmSourceFilesRule.h +SOURCE=..\cmSourceFilesCommand.h # End Source File # Begin Source File @@ -365,7 +365,7 @@ SOURCE=..\cmStandardIncludes.h # End Source File # Begin Source File -SOURCE=..\cmSubdirRule.h +SOURCE=..\cmSubdirCommand.h # End Source File # Begin Source File @@ -373,23 +373,23 @@ SOURCE=..\cmSystemTools.h # End Source File # Begin Source File -SOURCE=..\cmTestsRule.h +SOURCE=..\cmTestsCommand.h # End Source File # Begin Source File -SOURCE=..\cmUnixDefinesRule.h +SOURCE=..\cmUnixDefinesCommand.h # End Source File # Begin Source File -SOURCE=..\cmUnixLibrariesRule.h +SOURCE=..\cmUnixLibrariesCommand.h # End Source File # Begin Source File -SOURCE=..\cmWin32DefinesRule.h +SOURCE=..\cmWin32DefinesCommand.h # End Source File # Begin Source File -SOURCE=..\cmWin32LibrariesRule.h +SOURCE=..\cmWin32LibrariesCommand.h # End Source File # Begin Source File diff --git a/Source/Makefile.in b/Source/Makefile.in index b401795..babdaee 100644 --- a/Source/Makefile.in +++ b/Source/Makefile.in @@ -4,73 +4,73 @@ VPATH = @srcdir@ # DO NOT INCLUDE CMakeMaster.make here! # This will cause an infinite loop as it will add the -# rule for changing into this directory +# command for changing into this directory @MAKEINCLUDE@ @MAKEQUOTE@@CMAKE_CONFIG_DIR@/CMake/CMakeVariables.make@MAKEQUOTE@ -@MAKEINCLUDE@ @MAKEQUOTE@@CMAKE_CONFIG_DIR@/CMake/CMakeSimpleRules.make@MAKEQUOTE@ +@MAKEINCLUDE@ @MAKEQUOTE@@CMAKE_CONFIG_DIR@/CMake/CMakeSimpleCommands.make@MAKEQUOTE@ OBJS = \ CMakeBuildTargets.o \ cmMakeDepend.o \ cmMakefile.o \ -cmAbstractFilesRule.o \ +cmAbstractFilesCommand.o \ cmMakefileGenerator.o \ -cmAddTargetRule.o \ -cmProjectRule.o \ -cmAuxSourceDirectoryRule.o \ +cmAddTargetCommand.o \ +cmProjectCommand.o \ +cmAuxSourceDirectoryCommand.o \ cmRegularExpression.o \ cmClassFile.o \ -cmSourceFilesRule.o \ -cmSourceFilesRequireRule.o \ -cmSubdirRule.o \ +cmSourceFilesCommand.o \ +cmSourceFilesRequireCommand.o \ +cmSubdirCommand.o \ cmSystemTools.o \ cmDirectory.o \ -cmUnixDefinesRule.o \ -cmExecutablesRule.o \ -cmTestsRule.o \ -cmUnixLibrariesRule.o \ -cmFindIncludeRule.o \ -cmFindLibraryRule.o \ +cmUnixDefinesCommand.o \ +cmExecutablesCommand.o \ +cmTestsCommand.o \ +cmUnixLibrariesCommand.o \ +cmFindIncludeCommand.o \ +cmFindLibraryCommand.o \ cmUnixMakefileGenerator.o \ -cmFindProgramRule.o \ -cmIncludeDirectoryRule.o \ -cmWin32DefinesRule.o \ -cmLibraryRule.o \ -cmWin32LibrariesRule.o \ -cmLinkDirectoriesRule.o \ -cmLinkLibrariesRule.o +cmFindProgramCommand.o \ +cmIncludeDirectoryCommand.o \ +cmWin32DefinesCommand.o \ +cmLibraryCommand.o \ +cmWin32LibrariesCommand.o \ +cmLinkDirectoriesCommand.o \ +cmLinkLibrariesCommand.o cmCollectFlags.o : $(srcdir)/*.h CMakeBuildTargets.o : $(srcdir)/*.h cmMakeDepend.o : $(srcdir)/*.h cmMakefile.o : $(srcdir)/*.h -cmAbstractFilesRule.o : $(srcdir)/*.h +cmAbstractFilesCommand.o : $(srcdir)/*.h cmMakefileGenerator.o : $(srcdir)/*.h -cmAddTargetRule.o : $(srcdir)/*.h -cmProjectRule.o : $(srcdir)/*.h -cmAuxSourceDirectoryRule.o : $(srcdir)/*.h +cmAddTargetCommand.o : $(srcdir)/*.h +cmProjectCommand.o : $(srcdir)/*.h +cmAuxSourceDirectoryCommand.o : $(srcdir)/*.h cmRegularExpression.o : $(srcdir)/*.h cmClassFile.o : $(srcdir)/*.h -cmSourceFilesRule.o : $(srcdir)/*.h -cmSourceFilesRequireRule.o : $(srcdir)/*.h -cmSubdirRule.o : $(srcdir)/*.h +cmSourceFilesCommand.o : $(srcdir)/*.h +cmSourceFilesRequireCommand.o : $(srcdir)/*.h +cmSubdirCommand.o : $(srcdir)/*.h cmSystemTools.o : $(srcdir)/*.h cmDirectory.o : $(srcdir)/*.h -cmUnixDefinesRule.o : $(srcdir)/*.h -cmExecutablesRule.o : $(srcdir)/*.h -cmTestsRule.o : $(srcdir)/*.h -cmUnixLibrariesRule.o : $(srcdir)/*.h -cmFindIncludeRule.o : $(srcdir)/*.h -cmFindLibraryRule.o : $(srcdir)/*.h +cmUnixDefinesCommand.o : $(srcdir)/*.h +cmExecutablesCommand.o : $(srcdir)/*.h +cmTestsCommand.o : $(srcdir)/*.h +cmUnixLibrariesCommand.o : $(srcdir)/*.h +cmFindIncludeCommand.o : $(srcdir)/*.h +cmFindLibraryCommand.o : $(srcdir)/*.h cmUnixMakefileGenerator.o : $(srcdir)/*.h -cmFindProgramRule.o : $(srcdir)/*.h -cmIncludeDirectoryRule.o : $(srcdir)/*.h -cmWin32DefinesRule.o : $(srcdir)/*.h -cmLibraryRule.o : $(srcdir)/*.h -cmWin32LibrariesRule.o : $(srcdir)/*.h -cmLinkDirectoriesRule.o : $(srcdir)/*.h -cmLinkLibrariesRule.o : $(srcdir)/*.h +cmFindProgramCommand.o : $(srcdir)/*.h +cmIncludeDirectoryCommand.o : $(srcdir)/*.h +cmWin32DefinesCommand.o : $(srcdir)/*.h +cmLibraryCommand.o : $(srcdir)/*.h +cmWin32LibrariesCommand.o : $(srcdir)/*.h +cmLinkDirectoriesCommand.o : $(srcdir)/*.h +cmLinkLibrariesCommand.o : $(srcdir)/*.h CMakeBuildTargets: ${OBJS} diff --git a/Source/cmAbstractFilesCommand.cxx b/Source/cmAbstractFilesCommand.cxx new file mode 100644 index 0000000..2e8ed2f --- /dev/null +++ b/Source/cmAbstractFilesCommand.cxx @@ -0,0 +1,41 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmAbstractFilesCommand.h" + +// cmAbstractFilesCommand +bool cmAbstractFilesCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator j = args.begin(); + j != args.end(); ++j) + { + std::vector& Classes = m_Makefile->GetClasses(); + for(int i = 0; i < Classes.size(); i++) + { + if(Classes[i].m_ClassName == (*j)) + { + Classes[i].m_AbstractClass = true; + break; + } + } + } + return true; +} + diff --git a/Source/cmAbstractFilesCommand.h b/Source/cmAbstractFilesCommand.h new file mode 100644 index 0000000..6e7f73e --- /dev/null +++ b/Source/cmAbstractFilesCommand.h @@ -0,0 +1,61 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmAbstractFilesCommand_h +#define cmAbstractFilesCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +class cmAbstractFilesCommand : public cmCommand +{ +public: + virtual cmCommand* Clone() + { + return new cmAbstractFilesCommand; + } + + /** + * This is called when the command is first encountered in + * the input file. + */ + virtual bool Invoke(std::vector& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "ABSTRACT_FILES";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "A list of abstract classes, useful for wrappers."; + } + + /** + * Longer documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "ABSTRACT_FILES(file1 file2 ..)"; + } +}; + + + +#endif diff --git a/Source/cmAbstractFilesRule.cxx b/Source/cmAbstractFilesRule.cxx deleted file mode 100644 index 39634b9..0000000 --- a/Source/cmAbstractFilesRule.cxx +++ /dev/null @@ -1,41 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmAbstractFilesRule.h" - -// cmAbstractFilesRule -bool cmAbstractFilesRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator j = args.begin(); - j != args.end(); ++j) - { - std::vector& Classes = m_Makefile->GetClasses(); - for(int i = 0; i < Classes.size(); i++) - { - if(Classes[i].m_ClassName == (*j)) - { - Classes[i].m_AbstractClass = true; - break; - } - } - } - return true; -} - diff --git a/Source/cmAbstractFilesRule.h b/Source/cmAbstractFilesRule.h deleted file mode 100644 index 5eb51fc..0000000 --- a/Source/cmAbstractFilesRule.h +++ /dev/null @@ -1,67 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmAbstractFilesRule_h -#define cmAbstractFilesRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -class cmAbstractFilesRule : public cmRuleMaker -{ -public: - virtual cmRuleMaker* Clone() - { - return new cmAbstractFilesRule; - } - - /** - * This is called when the rule is first encountered in - * the input file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "ABSTRACT_FILES";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "A list of abstract classes, useful for wrappers."; - } - - /** - * Longer documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "ABSTRACT_FILES(file1 file2 ..)"; - } -}; - - - -#endif diff --git a/Source/cmAddTargetCommand.cxx b/Source/cmAddTargetCommand.cxx new file mode 100644 index 0000000..089f971 --- /dev/null +++ b/Source/cmAddTargetCommand.cxx @@ -0,0 +1,34 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmAddTargetCommand.h" + +// cmAddTargetCommand +bool cmAddTargetCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + return false; + +// for(std::vector::iterator i = args.begin(); +// i != args.end(); ++i) +// { +// m_Makefile->Add((*i).c_str()); +// } +} + diff --git a/Source/cmAddTargetCommand.h b/Source/cmAddTargetCommand.h new file mode 100644 index 0000000..01653e6 --- /dev/null +++ b/Source/cmAddTargetCommand.h @@ -0,0 +1,70 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmAddTargetCommand_h +#define cmAddTargetCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmAddTargetCommand + * \brief Command that adds a target to the build system. + * + * cmAddTargetCommand adds an extra target to the build system. + * This is useful when you would like to add special + * targets like "install,", "clean," and so on. + */ +class cmAddTargetCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmAddTargetCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() + {return "ADD_TARGET";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add an extra target to the build system."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "ADD_TARGET(Name \"command to run\")"; + } +}; + +#endif diff --git a/Source/cmAddTargetRule.cxx b/Source/cmAddTargetRule.cxx deleted file mode 100644 index c115e75..0000000 --- a/Source/cmAddTargetRule.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmAddTargetRule.h" - -// cmAddTargetRule -bool cmAddTargetRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - return false; - -// for(std::vector::iterator i = args.begin(); -// i != args.end(); ++i) -// { -// m_Makefile->Add((*i).c_str()); -// } -} - diff --git a/Source/cmAddTargetRule.h b/Source/cmAddTargetRule.h deleted file mode 100644 index 65d57e8..0000000 --- a/Source/cmAddTargetRule.h +++ /dev/null @@ -1,76 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmAddTargetRule_h -#define cmAddTargetRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmAddTargetRule - * \brief Rule that adds a target to the build system. - * - * cmAddTargetRule adds an extra target to the build system. - * This is useful when you would like to add special - * targets like "install,", "clean," and so on. - */ -class cmAddTargetRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmAddTargetRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() {} - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() - {return "ADD_TARGET";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add an extra target to the build system."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "ADD_TARGET(Name \"command to run\")"; - } -}; - -#endif diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx new file mode 100644 index 0000000..64aa7d2 --- /dev/null +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -0,0 +1,61 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmAuxSourceDirectoryCommand.h" +#include "cmDirectory.h" + +// cmAuxSourceDirectoryCommand +bool cmAuxSourceDirectoryCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 || args.size() > 1) + { + this->SetError("PROJECT called with incorrect number of arguments"); + return false; + } + + std::string templateDirectory = args[0]; + m_Makefile->AddExtraDirectory(templateDirectory.c_str()); + std::string tdir = m_Makefile->GetCurrentDirectory(); + tdir += "/"; + tdir += templateDirectory; + // Load all the files in the directory + cmDirectory dir; + if(dir.Load(tdir.c_str())) + { + int numfiles = dir.GetNumberOfFiles(); + for(int i =0; i < numfiles; ++i) + { + std::string file = dir.GetFile(i); + // ignore files less than f.cxx in length + if(file.size() > 4) + { + // Remove the extension + std::string::size_type dotpos = file.rfind("."); + file = file.substr(0, dotpos); + std::string fullname = templateDirectory; + fullname += "/"; + fullname += file; + // add the file as a class file so + // depends can be done + cmClassFile cmfile; + cmfile.SetName(fullname.c_str(), m_Makefile->GetCurrentDirectory()); + cmfile.m_AbstractClass = false; + m_Makefile->AddClass(cmfile); + } + } + } + return true; +} + diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h new file mode 100644 index 0000000..c830a76 --- /dev/null +++ b/Source/cmAuxSourceDirectoryCommand.h @@ -0,0 +1,74 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmAuxSourceDirectoryCommand_h +#define cmAuxSourceDirectoryCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmAuxSourceDirectoryCommand + * \brief Specify auxiliary source code directories. + * + * cmAuxSourceDirectoryCommand specifies source code directories + * that must be built as part of this build process. This directories + * are not recursively processed like the SUBDIR command (cmSubdirCommand). + * A side effect of this command is to create a subdirectory in the build + * directory structure. + */ +class cmAuxSourceDirectoryCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmAuxSourceDirectoryCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "AUX_SOURCE_DIRECTORY";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add all the source files found in the specified\n" + "directory to the build."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "AUX_SOURCE_DIRECTORY(dir)"; + } +}; + + + +#endif diff --git a/Source/cmAuxSourceDirectoryRule.cxx b/Source/cmAuxSourceDirectoryRule.cxx deleted file mode 100644 index 1b7f45a..0000000 --- a/Source/cmAuxSourceDirectoryRule.cxx +++ /dev/null @@ -1,61 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmAuxSourceDirectoryRule.h" -#include "cmDirectory.h" - -// cmAuxSourceDirectoryRule -bool cmAuxSourceDirectoryRule::Invoke(std::vector& args) -{ - if(args.size() < 1 || args.size() > 1) - { - this->SetError("PROJECT called with incorrect number of arguments"); - return false; - } - - std::string templateDirectory = args[0]; - m_Makefile->AddExtraDirectory(templateDirectory.c_str()); - std::string tdir = m_Makefile->GetCurrentDirectory(); - tdir += "/"; - tdir += templateDirectory; - // Load all the files in the directory - cmDirectory dir; - if(dir.Load(tdir.c_str())) - { - int numfiles = dir.GetNumberOfFiles(); - for(int i =0; i < numfiles; ++i) - { - std::string file = dir.GetFile(i); - // ignore files less than f.cxx in length - if(file.size() > 4) - { - // Remove the extension - std::string::size_type dotpos = file.rfind("."); - file = file.substr(0, dotpos); - std::string fullname = templateDirectory; - fullname += "/"; - fullname += file; - // add the file as a class file so - // depends can be done - cmClassFile cmfile; - cmfile.SetName(fullname.c_str(), m_Makefile->GetCurrentDirectory()); - cmfile.m_AbstractClass = false; - m_Makefile->AddClass(cmfile); - } - } - } - return true; -} - diff --git a/Source/cmAuxSourceDirectoryRule.h b/Source/cmAuxSourceDirectoryRule.h deleted file mode 100644 index 199e5bc..0000000 --- a/Source/cmAuxSourceDirectoryRule.h +++ /dev/null @@ -1,80 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmAuxSourceDirectoryRule_h -#define cmAuxSourceDirectoryRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmAuxSourceDirectoryRule - * \brief Specify auxiliary source code directories. - * - * cmAuxSourceDirectoryRule specifies source code directories - * that must be built as part of this build process. This directories - * are not recursively processed like the SUBDIR rule (cmSubdirRule). - * A side effect of this rule is to create a subdirectory in the build - * directory structure. - */ -class cmAuxSourceDirectoryRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmAuxSourceDirectoryRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "AUX_SOURCE_DIRECTORY";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add all the source files found in the specified\n" - "directory to the build."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "AUX_SOURCE_DIRECTORY(dir)"; - } -}; - - - -#endif diff --git a/Source/cmCommand.h b/Source/cmCommand.h new file mode 100644 index 0000000..7051d3e --- /dev/null +++ b/Source/cmCommand.h @@ -0,0 +1,138 @@ + /*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmCommand_h +#define cmCommand_h + +#include "cmStandardIncludes.h" +#include "cmMakefile.h" + +/** \class cmCommand + * \brief Superclass for all commands in CMake. + * + * cmCommand is the base class for all commands in CMake. A command + * manifests as an entry in CMakeLists.txt and produces one or + * more makefile rules. Commands are associated with a particular + * makefile. This base class cmCommand defines the API for commands + * to support such features as enable/disable, inheritance, + * documentation, and construction. + */ +class cmCommand +{ +public: + /** + * Construct the command. By default it is enabled with no makefile. + */ + cmCommand() + {m_Makefile = 0; m_Enabled = true;} + + /** + * Specify the makefile. + */ + void SetMakefile(cmMakefile*m) + {m_Makefile = m; } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args) = 0; + + /** + * This is called at the end after all the information + * specified by the command is accumulated. Most commands do + * not implement this method. + */ + virtual void FinalPass() {}; + + /** + * This is called to let the command check the cache. + */ + virtual void LoadCache() {} + + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() = 0; + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() + { + return false; + } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() = 0; + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() = 0; + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() = 0; + + /** + * Enable the command. + */ + void EnabledOn() + {m_Enabled = true;} + + /** + * Disable the command. + */ + void EnabledOff() + {m_Enabled = false;} + + /** + * Query whether the command is enabled. + */ + bool GetEnabled() + {return m_Enabled;} + + /** + * Disable or enable the command. + */ + void SetEnabled(bool enabled) + {m_Enabled = enabled;} + + /** + * Return the last error string. + */ + const char* GetError() + {return m_Error.c_str();} + +protected: + void SetError(const char* e) + { + m_Error = this->GetName(); + m_Error += " "; + m_Error += e; + } + cmMakefile* m_Makefile; + +private: + bool m_Enabled; + std::string m_Error; +}; + +#endif diff --git a/Source/cmDumpDocumentation.cxx b/Source/cmDumpDocumentation.cxx index 7034e03..51db267 100644 --- a/Source/cmDumpDocumentation.cxx +++ b/Source/cmDumpDocumentation.cxx @@ -1,4 +1,4 @@ -// Program extracts documentation describing rules from +// Program extracts documentation describing commands from // the CMake system. // #include "cmMakefile.h" diff --git a/Source/cmExecutablesCommand.cxx b/Source/cmExecutablesCommand.cxx new file mode 100644 index 0000000..748705d --- /dev/null +++ b/Source/cmExecutablesCommand.cxx @@ -0,0 +1,35 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmExecutablesCommand.h" + +// cmExecutableCommand +bool cmExecutablesCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + cmClassFile file; + file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory()); + m_Makefile->AddExecutable(file); + } + return true; +} + diff --git a/Source/cmExecutablesCommand.h b/Source/cmExecutablesCommand.h new file mode 100644 index 0000000..c420a87 --- /dev/null +++ b/Source/cmExecutablesCommand.h @@ -0,0 +1,69 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmExecutablesCommand_h +#define cmExecutablesCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmExecutablesCommand + * \brief Defines a list of executables to build. + * + * cmExecutablesCommand defines a list of executable (i.e., test) + * programs to create. + */ +class cmExecutablesCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmExecutablesCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "EXECUTABLES";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add a list of executables files."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "EXECUTABLES(file1 file2 ...)"; + } +}; + + +#endif diff --git a/Source/cmExecutablesRule.cxx b/Source/cmExecutablesRule.cxx deleted file mode 100644 index f00e080..0000000 --- a/Source/cmExecutablesRule.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmExecutablesRule.h" - -// cmExecutableRule -bool cmExecutablesRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - cmClassFile file; - file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory()); - m_Makefile->AddExecutable(file); - } - return true; -} - diff --git a/Source/cmExecutablesRule.h b/Source/cmExecutablesRule.h deleted file mode 100644 index 8026a33..0000000 --- a/Source/cmExecutablesRule.h +++ /dev/null @@ -1,75 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmExecutablesRule_h -#define cmExecutablesRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmExecutablesRule - * \brief Defines a list of executables to build. - * - * cmExecutablesRule defines a list of executable (i.e., test) - * programs to create. - */ -class cmExecutablesRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmExecutablesRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "EXECUTABLES";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add a list of executables files."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "EXECUTABLES(file1 file2 ...)"; - } -}; - - -#endif diff --git a/Source/cmFindIncludeCommand.cxx b/Source/cmFindIncludeCommand.cxx new file mode 100644 index 0000000..2b4160d --- /dev/null +++ b/Source/cmFindIncludeCommand.cxx @@ -0,0 +1,33 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmFindIncludeCommand.h" + +// cmFindIncludeCommand +bool cmFindIncludeCommand::Invoke(std::vector& args) +{ + return false; + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + m_Makefile->AddDefineFlag((*i).c_str()); + } +} + diff --git a/Source/cmFindIncludeCommand.h b/Source/cmFindIncludeCommand.h new file mode 100644 index 0000000..4b2cd4a --- /dev/null +++ b/Source/cmFindIncludeCommand.h @@ -0,0 +1,77 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmFindIncludeCommand_h +#define cmFindIncludeCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmFindIncludeCommand + * \brief Define a command that searches for an include file. + * + * cmFindIncludeCommand is used to define a CMake variable include + * path location by specifying a file and list of directories. + */ +class cmFindIncludeCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmFindIncludeCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() + {return true;} + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "FIND_INCLUDE";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Find an include path."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "FIND_INCLUDE(DEFINE try1 try2 ...)"; + } +}; + + + +#endif diff --git a/Source/cmFindIncludeRule.cxx b/Source/cmFindIncludeRule.cxx deleted file mode 100644 index 44a4c90..0000000 --- a/Source/cmFindIncludeRule.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmFindIncludeRule.h" - -// cmFindIncludeRule -bool cmFindIncludeRule::Invoke(std::vector& args) -{ - return false; - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - m_Makefile->AddDefineFlag((*i).c_str()); - } -} - diff --git a/Source/cmFindIncludeRule.h b/Source/cmFindIncludeRule.h deleted file mode 100644 index f9cd40e..0000000 --- a/Source/cmFindIncludeRule.h +++ /dev/null @@ -1,83 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmFindIncludeRule_h -#define cmFindIncludeRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmFindIncludeRule - * \brief Define a rule that searches for an include file. - * - * cmFindIncludeRule is used to define a CMake variable include - * path location by specifying a file and list of directories. - */ -class cmFindIncludeRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmFindIncludeRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * This determines if the rule gets propagated down - * to makefiles located in subdirectories. - */ - virtual bool IsInherited() - {return true;} - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "FIND_INCLUDE";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Find an include path."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "FIND_INCLUDE(DEFINE try1 try2 ...)"; - } -}; - - - -#endif diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx new file mode 100644 index 0000000..1eb2a5d --- /dev/null +++ b/Source/cmFindLibraryCommand.cxx @@ -0,0 +1,33 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmFindLibraryCommand.h" + +// cmFindLibraryCommand +bool cmFindLibraryCommand::Invoke(std::vector& args) +{ + return false; + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + m_Makefile->AddDefineFlag((*i).c_str()); + } +} + diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h new file mode 100644 index 0000000..a106409 --- /dev/null +++ b/Source/cmFindLibraryCommand.h @@ -0,0 +1,78 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmFindLibraryCommand_h +#define cmFindLibraryCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + + +/** \class cmFindLibraryCommand + * \brief Define a command to search for a library. + * + * cmFindLibraryCommand is used to define a CMake variable + * that specifies a library. The command searches for a given + * file in a list of directories. + */ +class cmFindLibraryCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmFindLibraryCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() {return true;} + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() {return "FIND_LIBRARY";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Find a library."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "FIND_LIBRARY(DEFINE try1 try2)"; + } +}; + + + +#endif diff --git a/Source/cmFindLibraryRule.cxx b/Source/cmFindLibraryRule.cxx deleted file mode 100644 index 4c0776d..0000000 --- a/Source/cmFindLibraryRule.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmFindLibraryRule.h" - -// cmFindLibraryRule -bool cmFindLibraryRule::Invoke(std::vector& args) -{ - return false; - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - m_Makefile->AddDefineFlag((*i).c_str()); - } -} - diff --git a/Source/cmFindLibraryRule.h b/Source/cmFindLibraryRule.h deleted file mode 100644 index f8dc66e..0000000 --- a/Source/cmFindLibraryRule.h +++ /dev/null @@ -1,84 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmFindLibraryRule_h -#define cmFindLibraryRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - - -/** \class cmFindLibraryRule - * \brief Define a rule to search for a library. - * - * cmFindLibraryRule is used to define a CMake variable - * that specifies a library. The rule searches for a given - * file in a list of directories. - */ -class cmFindLibraryRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmFindLibraryRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * This determines if the rule gets propagated down - * to makefiles located in subdirectories. - */ - virtual bool IsInherited() {return true;} - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() {return "FIND_LIBRARY";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Find a library."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "FIND_LIBRARY(DEFINE try1 try2)"; - } -}; - - - -#endif diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx new file mode 100644 index 0000000..1c0d6e1 --- /dev/null +++ b/Source/cmFindProgramCommand.cxx @@ -0,0 +1,80 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmFindProgramCommand.h" +#include +#include + +static void GetPath(std::vector& path) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + char* pathSep = ";"; +#else + char* pathSep = ":"; +#endif + std::string pathEnv = getenv("PATH"); + std::string::size_type start =0; + bool done = false; + while(!done) + { + std::string::size_type endpos = pathEnv.find(pathSep, start); + if(endpos != std::string::npos) + { + path.push_back(pathEnv.substr(start, endpos-start)); + start = endpos+1; + } + else + { + done = true; + } + } +} + + + +// cmFindProgramCommand +bool cmFindProgramCommand::Invoke(std::vector& args) +{ + if(args.size() < 2 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + + std::vector path; + GetPath(path); + std::vector::iterator i = args.begin(); + const char* define = (*i).c_str(); + i++; + for(; i != args.end(); ++i) + { + for(int k=0; k < path.size(); k++) + { + std::string tryPath = path[k]; + tryPath += "/"; + tryPath += *i; +#ifdef _WIN32 + tryPath += ".exe"; +#endif + if(cmSystemTools::FileExists(tryPath.c_str())) + { + m_Makefile->AddDefinition(define, tryPath.c_str()); + return true; + } + } + } + return false; +} + diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h new file mode 100644 index 0000000..8aa7ee9 --- /dev/null +++ b/Source/cmFindProgramCommand.h @@ -0,0 +1,78 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmFindProgramCommand_h +#define cmFindProgramCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmFindProgramCommand + * \brief Define a command to search for an executable program. + * + * cmFindProgramCommand is used to define a CMake variable + * that specifies an executable program. The command searches + * in the current path (e.g., PATH environment variable) for + * an executable that matches one of the supplied names. + */ +class cmFindProgramCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmFindProgramCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() { return true; } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "FIND_PROGRARM";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Find an executable program."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "FIND_PROGRAM(NAME executable1 executable2 ...)"; + } +}; + + + +#endif diff --git a/Source/cmFindProgramRule.cxx b/Source/cmFindProgramRule.cxx deleted file mode 100644 index f8abba1..0000000 --- a/Source/cmFindProgramRule.cxx +++ /dev/null @@ -1,80 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmFindProgramRule.h" -#include -#include - -static void GetPath(std::vector& path) -{ -#if defined(_WIN32) && !defined(__CYGWIN__) - char* pathSep = ";"; -#else - char* pathSep = ":"; -#endif - std::string pathEnv = getenv("PATH"); - std::string::size_type start =0; - bool done = false; - while(!done) - { - std::string::size_type endpos = pathEnv.find(pathSep, start); - if(endpos != std::string::npos) - { - path.push_back(pathEnv.substr(start, endpos-start)); - start = endpos+1; - } - else - { - done = true; - } - } -} - - - -// cmFindProgramRule -bool cmFindProgramRule::Invoke(std::vector& args) -{ - if(args.size() < 2 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - - std::vector path; - GetPath(path); - std::vector::iterator i = args.begin(); - const char* define = (*i).c_str(); - i++; - for(; i != args.end(); ++i) - { - for(int k=0; k < path.size(); k++) - { - std::string tryPath = path[k]; - tryPath += "/"; - tryPath += *i; -#ifdef _WIN32 - tryPath += ".exe"; -#endif - if(cmSystemTools::FileExists(tryPath.c_str())) - { - m_Makefile->AddDefinition(define, tryPath.c_str()); - return true; - } - } - } - return false; -} - diff --git a/Source/cmFindProgramRule.h b/Source/cmFindProgramRule.h deleted file mode 100644 index 97b954a..0000000 --- a/Source/cmFindProgramRule.h +++ /dev/null @@ -1,84 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmFindProgramRule_h -#define cmFindProgramRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmFindProgramRule - * \brief Define a rule to search for an executable program. - * - * cmFindProgramRule is used to define a CMake variable - * that specifies an executable program. The rule searches - * in the current path (e.g., PATH environment variable) for - * an executable that matches one of the supplied names. - */ -class cmFindProgramRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmFindProgramRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * This determines if the rule gets propagated down - * to makefiles located in subdirectories. - */ - virtual bool IsInherited() { return true; } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "FIND_PROGRARM";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Find an executable program."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "FIND_PROGRAM(NAME executable1 executable2 ...)"; - } -}; - - - -#endif diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx new file mode 100644 index 0000000..6c6f21d --- /dev/null +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -0,0 +1,33 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmIncludeDirectoryCommand.h" + +// cmIncludeDirectoryCommand +bool cmIncludeDirectoryCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + m_Makefile->AddIncludeDirectory((*i).c_str()); + } + return true; +} + diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h new file mode 100644 index 0000000..4236880 --- /dev/null +++ b/Source/cmIncludeDirectoryCommand.h @@ -0,0 +1,76 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmIncludeDirectoryCommand_h +#define cmIncludeDirectoryCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmIncludeDirectoryCommand + * \brief Add include directories to the build. + * + * cmIncludeDirectoryCommand is used to specify directory locations + * to search for included files. + */ +class cmIncludeDirectoryCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmIncludeDirectoryCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() {return true;} + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "INCLUDE_DIRECTORIES";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add include directories to the build."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "INCLUDE_DIRECTORIES(dir1 dir2 ...)"; + } +}; + + + +#endif diff --git a/Source/cmIncludeDirectoryRule.cxx b/Source/cmIncludeDirectoryRule.cxx deleted file mode 100644 index 5b65272..0000000 --- a/Source/cmIncludeDirectoryRule.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmIncludeDirectoryRule.h" - -// cmIncludeDirectoryRule -bool cmIncludeDirectoryRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - m_Makefile->AddIncludeDirectory((*i).c_str()); - } - return true; -} - diff --git a/Source/cmIncludeDirectoryRule.h b/Source/cmIncludeDirectoryRule.h deleted file mode 100644 index ad7ce7b..0000000 --- a/Source/cmIncludeDirectoryRule.h +++ /dev/null @@ -1,82 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmIncludeDirectoryRule_h -#define cmIncludeDirectoryRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmIncludeDirectoryRule - * \brief Add include directories to the build. - * - * cmIncludeDirectoryRule is used to specify directory locations - * to search for included files. - */ -class cmIncludeDirectoryRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmIncludeDirectoryRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * This determines if the rule gets propagated down - * to makefiles located in subdirectories. - */ - virtual bool IsInherited() {return true;} - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "INCLUDE_DIRECTORIES";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add include directories to the build."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "INCLUDE_DIRECTORIES(dir1 dir2 ...)"; - } -}; - - - -#endif diff --git a/Source/cmLibraryCommand.cxx b/Source/cmLibraryCommand.cxx new file mode 100644 index 0000000..02e5dc8 --- /dev/null +++ b/Source/cmLibraryCommand.cxx @@ -0,0 +1,29 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmLibraryCommand.h" + +// cmLibraryCommand +bool cmLibraryCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 || args.size() > 1) + { + this->SetError("PROJECT called with incorrect number of arguments"); + return false; + } + m_Makefile->SetLibraryName(args[0].c_str()); + return true; +} + diff --git a/Source/cmLibraryCommand.h b/Source/cmLibraryCommand.h new file mode 100644 index 0000000..74957cb --- /dev/null +++ b/Source/cmLibraryCommand.h @@ -0,0 +1,71 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmLibraryCommand_h +#define cmLibraryCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + + +/** \class cmLibraryCommand + * \brief Specify a name for a library. + * + * cmLibraryCommand is used to specify the name of a library to be + * generated by the build process. + */ +class cmLibraryCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmLibraryCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "LIBRARY";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Set a name for a library."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "LIBRARY(libraryname)"; + } +}; + + + +#endif diff --git a/Source/cmLibraryRule.cxx b/Source/cmLibraryRule.cxx deleted file mode 100644 index c090b5a..0000000 --- a/Source/cmLibraryRule.cxx +++ /dev/null @@ -1,29 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmLibraryRule.h" - -// cmLibraryRule -bool cmLibraryRule::Invoke(std::vector& args) -{ - if(args.size() < 1 || args.size() > 1) - { - this->SetError("PROJECT called with incorrect number of arguments"); - return false; - } - m_Makefile->SetLibraryName(args[0].c_str()); - return true; -} - diff --git a/Source/cmLibraryRule.h b/Source/cmLibraryRule.h deleted file mode 100644 index 7bde5c0..0000000 --- a/Source/cmLibraryRule.h +++ /dev/null @@ -1,77 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmLibraryRule_h -#define cmLibraryRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - - -/** \class cmLibraryRule - * \brief Specify a name for a library. - * - * cmLibraryRule is used to specify the name of a library to be - * generated by the build process. - */ -class cmLibraryRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmLibraryRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "LIBRARY";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Set a name for a library."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "LIBRARY(libraryname)"; - } -}; - - - -#endif diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx new file mode 100644 index 0000000..eee8923 --- /dev/null +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -0,0 +1,33 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmLinkDirectoriesCommand.h" + +// cmLinkDirectoriesCommand +bool cmLinkDirectoriesCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + m_Makefile->AddLinkDirectory((*i).c_str()); + } + return true; +} + diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h new file mode 100644 index 0000000..783c880 --- /dev/null +++ b/Source/cmLinkDirectoriesCommand.h @@ -0,0 +1,81 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmLinkDirectoriesCommand_h +#define cmLinkDirectoriesCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmLinkDirectoriesCommand + * \brief Define a list of directories containing files to link. + * + * cmLinkDirectoriesCommand is used to specify a list + * of directories containing files to link into executable(s). + * Note that the command supports the use of CMake built-in variables + * such as CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR. + */ +class cmLinkDirectoriesCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmLinkDirectoriesCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() { return true; } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "LINK_DIRECTORIES";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Specify link directories."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "LINK_DIRECTORIES(directory1 directory2 ...)\n" + "Specify the paths to the libraries that will be linked in.\n" + "The directories can use built in definitions like \n" + "CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR."; + } +}; + + + +#endif diff --git a/Source/cmLinkDirectoriesRule.cxx b/Source/cmLinkDirectoriesRule.cxx deleted file mode 100644 index 136c7bc..0000000 --- a/Source/cmLinkDirectoriesRule.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmLinkDirectoriesRule.h" - -// cmLinkDirectoriesRule -bool cmLinkDirectoriesRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - m_Makefile->AddLinkDirectory((*i).c_str()); - } - return true; -} - diff --git a/Source/cmLinkDirectoriesRule.h b/Source/cmLinkDirectoriesRule.h deleted file mode 100644 index a46c395..0000000 --- a/Source/cmLinkDirectoriesRule.h +++ /dev/null @@ -1,87 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmLinkDirectoriesRule_h -#define cmLinkDirectoriesRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmLinkDirectoriesRule - * \brief Define a list of directories containing files to link. - * - * cmLinkDirectoriesRule is used to specify a list - * of directories containing files to link into executable(s). - * Note that the rule supports the use of CMake built-in variables - * such as CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR. - */ -class cmLinkDirectoriesRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmLinkDirectoriesRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * This determines if the rule gets propagated down - * to makefiles located in subdirectories. - */ - virtual bool IsInherited() { return true; } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "LINK_DIRECTORIES";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Specify link directories."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "LINK_DIRECTORIES(directory1 directory2 ...)\n" - "Specify the paths to the libraries that will be linked in.\n" - "The directories can use built in definitions like \n" - "CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR."; - } -}; - - - -#endif diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx new file mode 100644 index 0000000..4215147 --- /dev/null +++ b/Source/cmLinkLibrariesCommand.cxx @@ -0,0 +1,33 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmLinkLibrariesCommand.h" + +// cmLinkLibrariesCommand +bool cmLinkLibrariesCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + m_Makefile->AddLinkLibrary((*i).c_str()); + } + return true; +} + diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h new file mode 100644 index 0000000..31e9310 --- /dev/null +++ b/Source/cmLinkLibrariesCommand.h @@ -0,0 +1,83 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmLinkLibrariesCommand_h +#define cmLinkLibrariesCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmLinkLibrariesCommand + * \brief Specify a list of libraries to link into executables. + * + * cmLinkLibrariesCommand is used to specify a list of libraries to link + * into executable(s) or shared objects. The names of the libraries + * should be those defined by the LIBRARY(library) command(s). + */ +class cmLinkLibrariesCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmLinkLibrariesCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() {return true;} + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "LINK_LIBRARIES";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return + "Specify a list of libraries to be linked into\n" + "executables or shared objects."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "LINK_LIBRARIES(library1 library2)\n" + "Specify a list of libraries to be linked into\n" + "executables or shared objects. This command is passed\n" + "down to all other commands. The library name should be\n" + "the same as the name used in the LIBRARY(library) command."; + } +}; + + + +#endif diff --git a/Source/cmLinkLibrariesRule.cxx b/Source/cmLinkLibrariesRule.cxx deleted file mode 100644 index 714a4ab..0000000 --- a/Source/cmLinkLibrariesRule.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmLinkLibrariesRule.h" - -// cmLinkLibrariesRule -bool cmLinkLibrariesRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - m_Makefile->AddLinkLibrary((*i).c_str()); - } - return true; -} - diff --git a/Source/cmLinkLibrariesRule.h b/Source/cmLinkLibrariesRule.h deleted file mode 100644 index 5a80b89..0000000 --- a/Source/cmLinkLibrariesRule.h +++ /dev/null @@ -1,89 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmLinkLibrariesRule_h -#define cmLinkLibrariesRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmLinkLibrariesRule - * \brief Specify a list of libraries to link into executables. - * - * cmLinkLibrariesRule is used to specify a list of libraries to link - * into executable(s) or shared objects. The names of the libraries - * should be those defined by the LIBRARY(library) rule(s). - */ -class cmLinkLibrariesRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmLinkLibrariesRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * This determines if the rule gets propagated down - * to makefiles located in subdirectories. - */ - virtual bool IsInherited() {return true;} - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "LINK_LIBRARIES";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return - "Specify a list of libraries to be linked into\n" - "executables or shared objects."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "LINK_LIBRARIES(library1 library2)\n" - "Specify a list of libraries to be linked into\n" - "executables or shared objects. This rule is passed\n" - "down to all other rules. The library name should be\n" - "the same as the name used in the LIBRARY(library) rule."; - } -}; - - - -#endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2ecab86..eea43f4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -14,33 +14,33 @@ =========================================================================*/ #include "cmMakefile.h" -#include "cmRuleMaker.h" +#include "cmCommand.h" #include "cmStandardIncludes.h" #include "cmClassFile.h" #include "cmDirectory.h" #include "cmSystemTools.h" #include "cmMakefileGenerator.h" -#include "cmAbstractFilesRule.h" -#include "cmAddTargetRule.h" -#include "cmAuxSourceDirectoryRule.h" -#include "cmExecutablesRule.h" -#include "cmFindIncludeRule.h" -#include "cmFindLibraryRule.h" -#include "cmFindProgramRule.h" -#include "cmIncludeDirectoryRule.h" -#include "cmLibraryRule.h" -#include "cmLinkDirectoriesRule.h" -#include "cmLinkLibrariesRule.h" -#include "cmProjectRule.h" -#include "cmSourceFilesRule.h" -#include "cmSourceFilesRequireRule.h" -#include "cmSubdirRule.h" -#include "cmUnixDefinesRule.h" -#include "cmUnixLibrariesRule.h" -#include "cmWin32DefinesRule.h" -#include "cmWin32LibrariesRule.h" -#include "cmTestsRule.h" +#include "cmAbstractFilesCommand.h" +#include "cmAddTargetCommand.h" +#include "cmAuxSourceDirectoryCommand.h" +#include "cmExecutablesCommand.h" +#include "cmFindIncludeCommand.h" +#include "cmFindLibraryCommand.h" +#include "cmFindProgramCommand.h" +#include "cmIncludeDirectoryCommand.h" +#include "cmLibraryCommand.h" +#include "cmLinkDirectoriesCommand.h" +#include "cmLinkLibrariesCommand.h" +#include "cmProjectCommand.h" +#include "cmSourceFilesCommand.h" +#include "cmSourceFilesRequireCommand.h" +#include "cmSubdirCommand.h" +#include "cmUnixDefinesCommand.h" +#include "cmUnixLibrariesCommand.h" +#include "cmWin32DefinesCommand.h" +#include "cmWin32LibrariesCommand.h" +#include "cmTestsCommand.h" // default is not to be building executables cmMakefile::cmMakefile() @@ -48,37 +48,37 @@ cmMakefile::cmMakefile() m_DefineFlags = " "; m_Executables = false; m_MakefileGenerator = 0; - this->AddDefaultRules(); + this->AddDefaultCommands(); } -void cmMakefile::AddDefaultRules() +void cmMakefile::AddDefaultCommands() { - this->AddRuleMaker(new cmAbstractFilesRule); - this->AddRuleMaker(new cmAddTargetRule); - this->AddRuleMaker(new cmAuxSourceDirectoryRule); - this->AddRuleMaker(new cmExecutablesRule); - this->AddRuleMaker(new cmFindIncludeRule); - this->AddRuleMaker(new cmFindLibraryRule); - this->AddRuleMaker(new cmFindProgramRule); - this->AddRuleMaker(new cmIncludeDirectoryRule); - this->AddRuleMaker(new cmLibraryRule); - this->AddRuleMaker(new cmLinkDirectoriesRule); - this->AddRuleMaker(new cmLinkLibrariesRule); - this->AddRuleMaker(new cmProjectRule); - this->AddRuleMaker(new cmSourceFilesRule); - this->AddRuleMaker(new cmSourceFilesRequireRule); - this->AddRuleMaker(new cmSubdirRule); - this->AddRuleMaker(new cmUnixLibrariesRule); - this->AddRuleMaker(new cmUnixDefinesRule); - this->AddRuleMaker(new cmWin32LibrariesRule); - this->AddRuleMaker(new cmWin32DefinesRule); - this->AddRuleMaker(new cmTestsRule); + this->AddCommand(new cmAbstractFilesCommand); + this->AddCommand(new cmAddTargetCommand); + this->AddCommand(new cmAuxSourceDirectoryCommand); + this->AddCommand(new cmExecutablesCommand); + this->AddCommand(new cmFindIncludeCommand); + this->AddCommand(new cmFindLibraryCommand); + this->AddCommand(new cmFindProgramCommand); + this->AddCommand(new cmIncludeDirectoryCommand); + this->AddCommand(new cmLibraryCommand); + this->AddCommand(new cmLinkDirectoriesCommand); + this->AddCommand(new cmLinkLibrariesCommand); + this->AddCommand(new cmProjectCommand); + this->AddCommand(new cmSourceFilesCommand); + this->AddCommand(new cmSourceFilesRequireCommand); + this->AddCommand(new cmSubdirCommand); + this->AddCommand(new cmUnixLibrariesCommand); + this->AddCommand(new cmUnixDefinesCommand); + this->AddCommand(new cmWin32LibrariesCommand); + this->AddCommand(new cmWin32DefinesCommand); + this->AddCommand(new cmTestsCommand); #ifdef _WIN32 this->AddDefinition("WIN32", "1"); #else this->AddDefinition("UNIX", "1"); #endif - // Cygwin is more like unix so enable the unix rules + // Cygwin is more like unix so enable the unix commands #if defined(__CYGWIN__) this->AddDefinition("UNIX", "1"); #endif @@ -87,12 +87,12 @@ void cmMakefile::AddDefaultRules() cmMakefile::~cmMakefile() { - for(int i=0; i < m_UsedRuleMakers.size(); i++) + for(int i=0; i < m_UsedCommands.size(); i++) { - delete m_UsedRuleMakers[i]; + delete m_UsedCommands[i]; } - for(StringRuleMakerMap::iterator j = m_RuleMakers.begin(); - j != m_RuleMakers.end(); ++j) + for(RegisteredCommandsMap::iterator j = m_Commands.begin(); + j != m_Commands.end(); ++j) { delete (*j).second; } @@ -162,8 +162,8 @@ bool cmMakefile::ReadMakefile(const char* filename, bool inheriting) { if(cmSystemTools::ParseFunction(fin, name, arguments) ) { - // Special rule that needs to be removed when - // ADD_RULE is implemented + // Special command that needs to be removed when + // ADD_COMMAND is implemented if(name == "VERBATIM") { if(!inheriting) @@ -173,23 +173,23 @@ bool cmMakefile::ReadMakefile(const char* filename, bool inheriting) } else { - StringRuleMakerMap::iterator pos = m_RuleMakers.find(name); - if(pos != m_RuleMakers.end()) + RegisteredCommandsMap::iterator pos = m_Commands.find(name); + if(pos != m_Commands.end()) { - cmRuleMaker* rm = (*pos).second; - cmRuleMaker* usedMaker = rm->Clone(); - usedMaker->SetMakefile(this); - usedMaker->LoadCache(); - m_UsedRuleMakers.push_back(usedMaker); - if(usedMaker->GetEnabled()) + cmCommand* rm = (*pos).second; + cmCommand* usedCommand = rm->Clone(); + usedCommand->SetMakefile(this); + usedCommand->LoadCache(); + m_UsedCommands.push_back(usedCommand); + if(usedCommand->GetEnabled()) { // if not running in inherit mode or - // if the rule is inherited then Invoke it. - if(!inheriting || usedMaker->IsInherited()) + // if the command is inherited then Invoke it. + if(!inheriting || usedCommand->IsInherited()) { - if(!usedMaker->Invoke(arguments)) + if(!usedCommand->Invoke(arguments)) { - cmSystemTools::Error(usedMaker->GetError()); + cmSystemTools::Error(usedCommand->GetError()); } } } @@ -205,10 +205,10 @@ bool cmMakefile::ReadMakefile(const char* filename, bool inheriting) } -void cmMakefile::AddRuleMaker(cmRuleMaker* wg) +void cmMakefile::AddCommand(cmCommand* wg) { std::string name = wg->GetName(); - m_RuleMakers.insert( StringRuleMakerMap::value_type(name, wg)); + m_Commands.insert( RegisteredCommandsMap::value_type(name, wg)); } // Set the make file @@ -225,10 +225,10 @@ void cmMakefile::GenerateMakefile() this->ExpandVaribles(); // set the makefile on the generator m_MakefileGenerator->SetMakefile(this); - // give all the rules a chance to do something + // give all the commands a chance to do something // after the file has been parsed before generation - for(std::vector::iterator i = m_UsedRuleMakers.begin(); - i != m_UsedRuleMakers.end(); ++i) + for(std::vector::iterator i = m_UsedCommands.begin(); + i != m_UsedCommands.end(); ++i) { (*i)->FinalPass(); } @@ -243,17 +243,17 @@ void cmMakefile::AddClass(cmClassFile& cmfile) -void cmMakefile::AddCustomRule(const char* source, +void cmMakefile::AddCustomCommand(const char* source, const char* result, const char* command, std::vector& depends) { - cmMakefile::customRule rule; - rule.m_Source = source; - rule.m_Result = result; - rule.m_Command = command; - rule.m_Depends = depends; - m_CustomRules.push_back(rule); + cmMakefile::customCommand customCommand; + customCommand.m_Source = source; + customCommand.m_Result = result; + customCommand.m_Command = command; + customCommand.m_Depends = depends; + m_CustomCommands.push_back(customCommand); } void cmMakefile::AddDefineFlag(const char* flag) @@ -384,13 +384,13 @@ int cmMakefile::DumpDocumentationToFile(const char *fileName) return 0; } - // Loop over all registered rules and print out documentation + // Loop over all registered commands and print out documentation const char *name; const char *terse; const char *full; - for(StringRuleMakerMap::iterator j = m_RuleMakers.begin(); - j != m_RuleMakers.end(); ++j) + for(RegisteredCommandsMap::iterator j = m_Commands.begin(); + j != m_Commands.end(); ++j) { name = (*j).second->GetName(); terse = (*j).second->GetTerseDocumentation(); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 6a444b4..c1a6980 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -20,14 +20,14 @@ #include "cmClassFile.h" #include "cmSystemTools.h" -class cmRuleMaker; +class cmCommand; class cmMakefileGenerator; /** \class cmMakefile * \brief Process the input CMakeLists.txt file. * * Process and store into memory the input CMakeLists.txt file. - * Each CMakeLists.txt file is parsed and the rules found there + * Each CMakeLists.txt file is parsed and the commands found there * are added into the build process. */ class cmMakefile @@ -51,7 +51,7 @@ public: /** * Add a wrapper generator. */ - void AddRuleMaker(cmRuleMaker* ); + void AddCommand(cmCommand* ); /** * Specify the makefile generator. This is platform/compiler @@ -71,9 +71,9 @@ public: void Print(); /** - * Add a custom rule to the build. + * Add a custom command to the build. */ - void AddCustomRule(const char* source, + void AddCustomCommand(const char* source, const char* result, const char* command, std::vector& depends); @@ -326,19 +326,19 @@ protected: std::vector m_LinkLibrariesUnix; std::string m_DefineFlags; std::string m_SourceHomeDirectory; - struct customRule + struct customCommand { std::string m_Source; std::string m_Result; std::string m_Command; std::vector m_Depends; }; - std::vector m_CustomRules; - typedef std::map StringRuleMakerMap; + std::vector m_CustomCommands; + typedef std::map RegisteredCommandsMap; typedef std::map DefinitionMap; DefinitionMap m_Definitions; - StringRuleMakerMap m_RuleMakers; - std::vector m_UsedRuleMakers; + RegisteredCommandsMap m_Commands; + std::vector m_UsedCommands; cmMakefileGenerator* m_MakefileGenerator; private: @@ -358,7 +358,7 @@ private: friend class cmMakeDepend; // make depend needs direct access // to the m_Classes array void PrintStringVector(const char* s, std::vector& v); - void AddDefaultRules(); + void AddDefaultCommands(); }; diff --git a/Source/cmMakefileGenerator.h b/Source/cmMakefileGenerator.h index 2ab50e4..974e98c 100644 --- a/Source/cmMakefileGenerator.h +++ b/Source/cmMakefileGenerator.h @@ -36,7 +36,7 @@ public: void SetMakefile(cmMakefile*); /** - * Generate the makefile using the m_Makefile, m_CustomRules, + * Generate the makefile using the m_Makefile, m_CustomCommands, * and m_ExtraSourceFiles. All subclasses of cmMakefileGenerator * must implement this method. */ diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx new file mode 100644 index 0000000..b35e15d --- /dev/null +++ b/Source/cmProjectCommand.cxx @@ -0,0 +1,29 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmProjectCommand.h" + +// cmProjectCommand +bool cmProjectCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 || args.size() > 1) + { + this->SetError("PROJECT called with incorrect number of arguments"); + return false; + } + m_Makefile->SetProjectName(args[0].c_str()); + return true; +} + diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h new file mode 100644 index 0000000..3a705e8 --- /dev/null +++ b/Source/cmProjectCommand.h @@ -0,0 +1,71 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmProjectCommand_h +#define cmProjectCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmProjectCommand + * \brief Specify the name for this build project. + * + * cmProjectCommand is used to specify a name for this build project. + * It is defined once per set of CMakeList.txt files (including + * all subdirectories). + */ +class cmProjectCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmProjectCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() {return "PROJECT";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Set a name for the entire project. One argument."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "PROJECT(projectname)\n"; + } +}; + + + +#endif diff --git a/Source/cmProjectRule.cxx b/Source/cmProjectRule.cxx deleted file mode 100644 index b1a88c2..0000000 --- a/Source/cmProjectRule.cxx +++ /dev/null @@ -1,29 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmProjectRule.h" - -// cmProjectRule -bool cmProjectRule::Invoke(std::vector& args) -{ - if(args.size() < 1 || args.size() > 1) - { - this->SetError("PROJECT called with incorrect number of arguments"); - return false; - } - m_Makefile->SetProjectName(args[0].c_str()); - return true; -} - diff --git a/Source/cmProjectRule.h b/Source/cmProjectRule.h deleted file mode 100644 index 304bcb3..0000000 --- a/Source/cmProjectRule.h +++ /dev/null @@ -1,77 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmProjectRule_h -#define cmProjectRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmProjectRule - * \brief Specify the name for this build project. - * - * cmProjectRule is used to specify a name for this build project. - * It is defined once per set of CMakeList.txt files (including - * all subdirectories). - */ -class cmProjectRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmProjectRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() {return "PROJECT";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Set a name for the entire project. One argument."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "PROJECT(projectname)\n"; - } -}; - - - -#endif diff --git a/Source/cmRuleMaker.h b/Source/cmRuleMaker.h deleted file mode 100644 index b653c38..0000000 --- a/Source/cmRuleMaker.h +++ /dev/null @@ -1,129 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmRuleMaker_h -#define cmRuleMaker_h - -#include "cmStandardIncludes.h" -#include "cmMakefile.h" - -/** \class cmRuleMaker - * \brief Superclass for all rules in CMake. - * - * cmRuleMaker is the base class for all rules in CMake. - * cmRuleMaker defines the API for rules with such features - * as enable/disable, inheritance, documentation, and construction. - */ -class cmRuleMaker -{ -public: - /** - * Construct the rule enabled with no makefile. - * the input file. - */ - cmRuleMaker() - {m_Makefile = 0; m_Enabled = true;} - - /** - * Specify the makefile. - */ - void SetMakefile(cmMakefile*m) - {m_Makefile = m; } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args) = 0; - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() = 0; - - /** - * This is called to let the rule check the cache. - */ - virtual void LoadCache() {} - - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() = 0; - - /** - * This determines if the rule gets propagated down - * to makefiles located in subdirectories. - */ - virtual bool IsInherited() - { - return false; - } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() = 0; - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() = 0; - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() = 0; - - /** - * Enable the rule. - */ - void EnabledOn() - {m_Enabled = true;} - - /** - * Disable the rule. - */ - void EnabledOff() - {m_Enabled = false;} - - /** - * Query whether the rule is enabled. - */ - bool GetEnabled() - {return m_Enabled;} - - /** - * Return the last error string. - */ - const char* GetError() - {return m_Error.c_str();} - -protected: - void SetError(const char* e) - { - m_Error = this->GetName(); - m_Error += " "; - m_Error += e; - } - cmMakefile* m_Makefile; - -private: - bool m_Enabled; - std::string m_Error; -}; - -#endif diff --git a/Source/cmSourceFilesCommand.cxx b/Source/cmSourceFilesCommand.cxx new file mode 100644 index 0000000..0e08de1 --- /dev/null +++ b/Source/cmSourceFilesCommand.cxx @@ -0,0 +1,36 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmSourceFilesCommand.h" + +// cmSourceFilesCommand +bool cmSourceFilesCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + cmClassFile file; + file.m_AbstractClass = false; + file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory()); + m_Makefile->AddClass(file); + } + return true; +} + diff --git a/Source/cmSourceFilesCommand.h b/Source/cmSourceFilesCommand.h new file mode 100644 index 0000000..f534339 --- /dev/null +++ b/Source/cmSourceFilesCommand.h @@ -0,0 +1,75 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmSourceFilesCommand_h +#define cmSourceFilesCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmSourceFilesCommand + * \brief Add source files to the build. + * + * cmSourceFilesCommand adds source files to the build. The source + * files will be added to the current library (if defined by the + * LIBRARY(library) command. Use this command to add source files not + * dependent on other packages (use SOURCE_FILES_REQUIRED() to add + * dependent source files). + * + * \sa cmSourceFilesRequireCommand + */ +class cmSourceFilesCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmSourceFilesCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "SOURCE_FILES";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add a list of source files."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "SOURCE_FILES(file1 file2 ...)"; + } +}; + + + +#endif diff --git a/Source/cmSourceFilesRequireCommand.cxx b/Source/cmSourceFilesRequireCommand.cxx new file mode 100644 index 0000000..a489689 --- /dev/null +++ b/Source/cmSourceFilesRequireCommand.cxx @@ -0,0 +1,54 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmSourceFilesRequireCommand.h" + +// cmSourceFilesRequireCommand +bool cmSourceFilesRequireCommand::Invoke(std::vector& args) +{ + if(args.size() < 3 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + std::vector::iterator i = args.begin(); + // Search to the key word SOURCES_BEGIN is found + // if one of the required defines is not there, then + // return as none of the source files will be added + // if the required definition is not there. + while(i != args.end() && (*i) != "SOURCES_BEGIN" ) + { + if(!m_Makefile->GetDefinition((*i).c_str())) + { + return true; + } + i++; + } + if(i != args.end()) + { + i++; + } + + // Add the rest of the arguments as source files + for(; i != args.end(); ++i) + { + cmClassFile file; + file.m_AbstractClass = false; + file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory()); + m_Makefile->AddClass(file); + } + return true; +} + diff --git a/Source/cmSourceFilesRequireCommand.h b/Source/cmSourceFilesRequireCommand.h new file mode 100644 index 0000000..e84c21e --- /dev/null +++ b/Source/cmSourceFilesRequireCommand.h @@ -0,0 +1,73 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmSourceFilesRequireCommand_h +#define cmSourceFilesRequireCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmSourceFilesRequireCommand + * \brief Add additional sources to the build if certain required files + * or CMake variables are defined. + * + * cmSourceFilesRequireCommand conditionally adds source files to the + * build if the specified files of CMake variables are defined. + * This command can be used to add source files that depend on external + * packages or operating system features. +*/ +class cmSourceFilesRequireCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmSourceFilesRequireCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "SOURCE_FILES_REQUIRE";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add a list of source files if the required \n" + "variables are set."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "SOURCE_FILES_REQUIRE(var1 var2 ... SOURCES_BEGIN file1 file2 ...)"; + } +}; + + +#endif diff --git a/Source/cmSourceFilesRequireRule.cxx b/Source/cmSourceFilesRequireRule.cxx deleted file mode 100644 index 2755205..0000000 --- a/Source/cmSourceFilesRequireRule.cxx +++ /dev/null @@ -1,54 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmSourceFilesRequireRule.h" - -// cmSourceFilesRequireRule -bool cmSourceFilesRequireRule::Invoke(std::vector& args) -{ - if(args.size() < 3 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - std::vector::iterator i = args.begin(); - // Search to the key word SOURCES_BEGIN is found - // if one of the required defines is not there, then - // return as none of the source files will be added - // if the required definition is not there. - while(i != args.end() && (*i) != "SOURCES_BEGIN" ) - { - if(!m_Makefile->GetDefinition((*i).c_str())) - { - return true; - } - i++; - } - if(i != args.end()) - { - i++; - } - - // Add the rest of the arguments as source files - for(; i != args.end(); ++i) - { - cmClassFile file; - file.m_AbstractClass = false; - file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory()); - m_Makefile->AddClass(file); - } - return true; -} - diff --git a/Source/cmSourceFilesRequireRule.h b/Source/cmSourceFilesRequireRule.h deleted file mode 100644 index ba8b2e3..0000000 --- a/Source/cmSourceFilesRequireRule.h +++ /dev/null @@ -1,79 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmSourceFilesRequireRule_h -#define cmSourceFilesRequireRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmSourceFilesRequireRule - * \brief Add additional sources to the build if certain required files - * or CMake variables are defined. - * - * cmSourceFilesRequireRule conditionally adds source files to the - * build if the specified files of CMake variables are defined. - * This rule can be used to add source files that depend on external - * packages or operating system features. -*/ -class cmSourceFilesRequireRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmSourceFilesRequireRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "SOURCE_FILES_REQUIRE";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add a list of source files if the required \n" - "variables are set."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "SOURCE_FILES_REQUIRE(var1 var2 ... SOURCES_BEGIN file1 file2 ...)"; - } -}; - - -#endif diff --git a/Source/cmSourceFilesRule.cxx b/Source/cmSourceFilesRule.cxx deleted file mode 100644 index 11eec2d..0000000 --- a/Source/cmSourceFilesRule.cxx +++ /dev/null @@ -1,36 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmSourceFilesRule.h" - -// cmSourceFilesRule -bool cmSourceFilesRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - cmClassFile file; - file.m_AbstractClass = false; - file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory()); - m_Makefile->AddClass(file); - } - return true; -} - diff --git a/Source/cmSourceFilesRule.h b/Source/cmSourceFilesRule.h deleted file mode 100644 index 36fe3b9..0000000 --- a/Source/cmSourceFilesRule.h +++ /dev/null @@ -1,81 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmSourceFilesRule_h -#define cmSourceFilesRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmSourceFilesRule - * \brief Add source files to the build. - * - * cmSourceFilesRule adds source files to the build. The source - * files will be added to the current library (if defined by the - * LIBRARY(library) rule. Use this rule to add source files not - * dependent on other packages (use SOURCE_FILES_REQUIRED() to add - * dependent source files). - * - * \sa cmSourceFilesRequireRule - */ -class cmSourceFilesRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmSourceFilesRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "SOURCE_FILES";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add a list of source files."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "SOURCE_FILES(file1 file2 ...)"; - } -}; - - - -#endif diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx new file mode 100644 index 0000000..943b8b9 --- /dev/null +++ b/Source/cmSubdirCommand.cxx @@ -0,0 +1,33 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmSubdirCommand.h" + +// cmSubdirCommand +bool cmSubdirCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + m_Makefile->AddSubDirectory((*i).c_str()); + } + return true; +} + diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h new file mode 100644 index 0000000..43a501e --- /dev/null +++ b/Source/cmSubdirCommand.h @@ -0,0 +1,74 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmSubdirCommand_h +#define cmSubdirCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmSubdirCommand + * \brief Specify a list of subdirectories to build. + * + * cmSubdirCommand specifies a list of subdirectories to process + * by CMake. For each subdirectory listed, CMake will descend + * into that subdirectory and process any CMakeLists.txt found. + */ +class cmSubdirCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmSubdirCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "SUBDIRS";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add a list of subdirectories to the build."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "SUBDIRS(dir1 dir2 ...)\n" + "Add a list of subdirectories to the build.\n" + "This will cause any CMakeLists.txt files in the sub directories\n" + "to be processed by CMake."; + } +}; + + + +#endif diff --git a/Source/cmSubdirRule.cxx b/Source/cmSubdirRule.cxx deleted file mode 100644 index e0f6402..0000000 --- a/Source/cmSubdirRule.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmSubdirRule.h" - -// cmSubdirRule -bool cmSubdirRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - m_Makefile->AddSubDirectory((*i).c_str()); - } - return true; -} - diff --git a/Source/cmSubdirRule.h b/Source/cmSubdirRule.h deleted file mode 100644 index 5b708c6..0000000 --- a/Source/cmSubdirRule.h +++ /dev/null @@ -1,80 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmSubdirRule_h -#define cmSubdirRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmSubdirRule - * \brief Specify a list of subdirectories to build. - * - * cmSubdirRule specifies a list of subdirectories to process - * by CMake. For each subdirectory listed, CMake will descend - * into that subdirectory and process any CMakeLists.txt found. - */ -class cmSubdirRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmSubdirRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "SUBDIRS";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add a list of subdirectories to the build."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "SUBDIRS(dir1 dir2 ...)\n" - "Add a list of subdirectories to the build.\n" - "This will cause any CMakeLists.txt files in the sub directories\n" - "to be processed by CMake."; - } -}; - - - -#endif diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 199d29c..cabdac0 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -65,7 +65,7 @@ public: static void ConvertCygwinPath(std::string& pathname); /** - * Read a CMake rule (or function) from an input file. This + * Read a CMake command (or function) from an input file. This * returns the name of the function and a list of its * arguments. */ diff --git a/Source/cmTestsCommand.cxx b/Source/cmTestsCommand.cxx new file mode 100644 index 0000000..4707ab9 --- /dev/null +++ b/Source/cmTestsCommand.cxx @@ -0,0 +1,35 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmTestsCommand.h" + +// cmExecutableCommand +bool cmTestsCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + cmClassFile file; + file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory()); + m_Makefile->AddExecutable(file); + } + return true; +} + diff --git a/Source/cmTestsCommand.h b/Source/cmTestsCommand.h new file mode 100644 index 0000000..ec001b3 --- /dev/null +++ b/Source/cmTestsCommand.h @@ -0,0 +1,74 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmTestsCommand_h +#define cmTestsCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmTestsCommand + * \brief Specify a list of executables to build and which are + * identified as tests. + * + * cmTestsCommand specifies a list of executables to be built by CMake. + * These executables are identified as tests. This command is similar to + * the EXECUTABLES() command. + * + * \sa cmExecutablesCommand + */ +class cmTestsCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmTestsCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() {return "TESTS";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add a list of executables files that are run as tests."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "TESTS(file1 file2 ...)"; + } +}; + + + +#endif diff --git a/Source/cmTestsRule.cxx b/Source/cmTestsRule.cxx deleted file mode 100644 index 7bf66e0..0000000 --- a/Source/cmTestsRule.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmTestsRule.h" - -// cmExecutableRule -bool cmTestsRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - cmClassFile file; - file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory()); - m_Makefile->AddExecutable(file); - } - return true; -} - diff --git a/Source/cmTestsRule.h b/Source/cmTestsRule.h deleted file mode 100644 index cc1686c..0000000 --- a/Source/cmTestsRule.h +++ /dev/null @@ -1,80 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmTestsRule_h -#define cmTestsRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmTestsRule - * \brief Specify a list of executables to build and which are - * identified as tests. - * - * cmTestsRule specifies a list of executables to be built by CMake. - * These executables are identified as tests. This rule is similar to - * the EXECUTABLES() rule. - * - * \sa cmExecutablesRule - */ -class cmTestsRule : public cmRuleMaker -{ -public: - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmTestsRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() {return "TESTS";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add a list of executables files that are run as tests."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "TESTS(file1 file2 ...)"; - } -}; - - - -#endif diff --git a/Source/cmUnixDefinesCommand.cxx b/Source/cmUnixDefinesCommand.cxx new file mode 100644 index 0000000..00f9a9a --- /dev/null +++ b/Source/cmUnixDefinesCommand.cxx @@ -0,0 +1,40 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmUnixDefinesCommand.h" + +cmUnixDefinesCommand::cmUnixDefinesCommand() +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + this->EnabledOff(); +#endif +} + +// cmUNIXDefinesCommand +bool cmUnixDefinesCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("Win32Defines called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + m_Makefile->AddDefineFlag((*i).c_str()); + } + return true; +} + diff --git a/Source/cmUnixDefinesCommand.h b/Source/cmUnixDefinesCommand.h new file mode 100644 index 0000000..f912ff4 --- /dev/null +++ b/Source/cmUnixDefinesCommand.h @@ -0,0 +1,82 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmUnixDefinesCommand_h +#define cmUnixDefinesCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmUnixDefinesCommand + * \brief Specify a list of compiler defines for Unix platforms. + * + * cmUnixDefinesCommand specifies a list of compiler defines for Unix platforms + * only. This defines will be added to the compile command. + */ +class cmUnixDefinesCommand : public cmCommand +{ +public: + /** + * Constructor. + */ + cmUnixDefinesCommand(); + + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmUnixDefinesCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() {return true;} + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "UNIX_DEFINES";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add -D flags to the command line for Unix only."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "UNIX_DEFINES(-DFOO -DBAR)\n" + "Add -D flags to the command line for Unix only."; + } +}; + + + +#endif diff --git a/Source/cmUnixDefinesRule.cxx b/Source/cmUnixDefinesRule.cxx deleted file mode 100644 index 05ec4ca..0000000 --- a/Source/cmUnixDefinesRule.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmUnixDefinesRule.h" - -cmUnixDefinesRule::cmUnixDefinesRule() -{ -#if defined(_WIN32) && !defined(__CYGWIN__) - this->EnabledOff(); -#endif -} - -// cmUNIXDefinesRule -bool cmUnixDefinesRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("Win32Defines called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - m_Makefile->AddDefineFlag((*i).c_str()); - } - return true; -} - diff --git a/Source/cmUnixDefinesRule.h b/Source/cmUnixDefinesRule.h deleted file mode 100644 index aa2e281..0000000 --- a/Source/cmUnixDefinesRule.h +++ /dev/null @@ -1,88 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmUnixDefinesRule_h -#define cmUnixDefinesRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmUnixDefinesRule - * \brief Specify a list of compiler defines for Unix platforms. - * - * cmUnixDefinesRule specifies a list of compiler defines for Unix platforms - * only. This defines will be added to the compile command. - */ -class cmUnixDefinesRule : public cmRuleMaker -{ -public: - /** - * Constructor. - */ - cmUnixDefinesRule(); - - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmUnixDefinesRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * This determines if the rule gets propagated down - * to makefiles located in subdirectories. - */ - virtual bool IsInherited() {return true;} - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "UNIX_DEFINES";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add -D flags to the command line for Unix only."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "UNIX_DEFINES(-DFOO -DBAR)\n" - "Add -D flags to the command line for Unix only."; - } -}; - - - -#endif diff --git a/Source/cmUnixLibrariesCommand.cxx b/Source/cmUnixLibrariesCommand.cxx new file mode 100644 index 0000000..a32529c --- /dev/null +++ b/Source/cmUnixLibrariesCommand.cxx @@ -0,0 +1,40 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmUnixLibrariesCommand.h" + +cmUnixLibrariesCommand::cmUnixLibrariesCommand() +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + this->EnabledOff(); +#endif +} + +// cmUnixLibrariesCommand +bool cmUnixLibrariesCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + m_Makefile->AddLinkLibrary((*i).c_str()); + } + return true; +} + diff --git a/Source/cmUnixLibrariesCommand.h b/Source/cmUnixLibrariesCommand.h new file mode 100644 index 0000000..80a77a4 --- /dev/null +++ b/Source/cmUnixLibrariesCommand.h @@ -0,0 +1,81 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmUnixLibrariesCommand_h +#define cmUnixLibrariesCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmUnixLibrariesCommand + * \brief Specify a list of libraries for Unix platforms. + * + * cmUnixLibrariesCommand specifies a list of libraries for Unix platforms + * only. Both user and system libraries can be listed. + */ +class cmUnixLibrariesCommand : public cmCommand +{ +public: + /** + * Constructor. + */ + cmUnixLibrariesCommand(); + + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmUnixLibrariesCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() {return true;} + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() {return "UNIX_LIBRARIES";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add libraries that are only used for Unix programs."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "UNIX_LIBRARIES(library -lm ...)"; + } +}; + + + +#endif diff --git a/Source/cmUnixLibrariesRule.cxx b/Source/cmUnixLibrariesRule.cxx deleted file mode 100644 index 48e0417..0000000 --- a/Source/cmUnixLibrariesRule.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmUnixLibrariesRule.h" - -cmUnixLibrariesRule::cmUnixLibrariesRule() -{ -#if defined(_WIN32) && !defined(__CYGWIN__) - this->EnabledOff(); -#endif -} - -// cmUnixLibrariesRule -bool cmUnixLibrariesRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - m_Makefile->AddLinkLibrary((*i).c_str()); - } - return true; -} - diff --git a/Source/cmUnixLibrariesRule.h b/Source/cmUnixLibrariesRule.h deleted file mode 100644 index 41b6e4c..0000000 --- a/Source/cmUnixLibrariesRule.h +++ /dev/null @@ -1,87 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmUnixLibrariesRule_h -#define cmUnixLibrariesRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmUnixLibrariesRule - * \brief Specify a list of libraries for Unix platforms. - * - * cmUnixLibrariesRule specifies a list of libraries for Unix platforms - * only. Both user and system libraries can be listed. - */ -class cmUnixLibrariesRule : public cmRuleMaker -{ -public: - /** - * Constructor. - */ - cmUnixLibrariesRule(); - - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmUnixLibrariesRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * This determines if the rule gets propagated down - * to makefiles located in subdirectories. - */ - virtual bool IsInherited() {return true;} - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() {return "UNIX_LIBRARIES";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add libraries that are only used for Unix programs."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "UNIX_LIBRARIES(library -lm ...)"; - } -}; - - - -#endif diff --git a/Source/cmWin32DefinesCommand.cxx b/Source/cmWin32DefinesCommand.cxx new file mode 100644 index 0000000..4821b86 --- /dev/null +++ b/Source/cmWin32DefinesCommand.cxx @@ -0,0 +1,40 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmWin32DefinesCommand.h" + +cmWin32DefinesCommand::cmWin32DefinesCommand() +{ +#ifndef _WIN32 + this->EnabledOff(); +#endif +} + +// cmWin32DefinesCommand +bool cmWin32DefinesCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + m_Makefile->AddDefineFlag((*i).c_str()); + } + return true; +} + diff --git a/Source/cmWin32DefinesCommand.h b/Source/cmWin32DefinesCommand.h new file mode 100644 index 0000000..a8e0da8 --- /dev/null +++ b/Source/cmWin32DefinesCommand.h @@ -0,0 +1,82 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmWin32DefinesCommand_h +#define cmWin32DefinesCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmWin32DefinesCommand + * \brief Specify a list of compiler defines for Win32 platforms. + * + * cmWin32DefinesCommand specifies a list of compiler defines for Win32 platforms + * only. This defines will be added to the compile command. + */ +class cmWin32DefinesCommand : public cmCommand +{ +public: + /** + * Constructor. + */ + cmWin32DefinesCommand(); + + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmWin32DefinesCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() {return true;} + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() {return "WIN32_DEFINES";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add -D define flags to command line for Win32 environments."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "WIN32_DEFINES(-DFOO -DBAR ...)\n" + "Add -D define flags to command line for Win32 environments."; + } +}; + + + +#endif diff --git a/Source/cmWin32DefinesRule.cxx b/Source/cmWin32DefinesRule.cxx deleted file mode 100644 index 43ed636..0000000 --- a/Source/cmWin32DefinesRule.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmWin32DefinesRule.h" - -cmWin32DefinesRule::cmWin32DefinesRule() -{ -#ifndef _WIN32 - this->EnabledOff(); -#endif -} - -// cmWin32DefinesRule -bool cmWin32DefinesRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - m_Makefile->AddDefineFlag((*i).c_str()); - } - return true; -} - diff --git a/Source/cmWin32DefinesRule.h b/Source/cmWin32DefinesRule.h deleted file mode 100644 index 4268a8e..0000000 --- a/Source/cmWin32DefinesRule.h +++ /dev/null @@ -1,88 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmWin32DefinesRule_h -#define cmWin32DefinesRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmWin32DefinesRule - * \brief Specify a list of compiler defines for Win32 platforms. - * - * cmWin32DefinesRule specifies a list of compiler defines for Win32 platforms - * only. This defines will be added to the compile command. - */ -class cmWin32DefinesRule : public cmRuleMaker -{ -public: - /** - * Constructor. - */ - cmWin32DefinesRule(); - - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmWin32DefinesRule; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * This determines if the rule gets propagated down - * to makefiles located in subdirectories. - */ - virtual bool IsInherited() {return true;} - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() {return "WIN32_DEFINES";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add -D define flags to command line for Win32 environments."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "WIN32_DEFINES(-DFOO -DBAR ...)\n" - "Add -D define flags to command line for Win32 environments."; - } -}; - - - -#endif diff --git a/Source/cmWin32LibrariesCommand.cxx b/Source/cmWin32LibrariesCommand.cxx new file mode 100644 index 0000000..a3e02b1 --- /dev/null +++ b/Source/cmWin32LibrariesCommand.cxx @@ -0,0 +1,41 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#include "cmWin32LibrariesCommand.h" + +cmWin32LibrariesCommand::cmWin32LibrariesCommand() +{ +#ifndef _WIN32 + this->EnabledOff(); +#endif +} + + +// cmWin32LibrariesCommand +bool cmWin32LibrariesCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("Called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + m_Makefile->AddLinkLibrary((*i).c_str()); + } + return true; +} + diff --git a/Source/cmWin32LibrariesCommand.h b/Source/cmWin32LibrariesCommand.h new file mode 100644 index 0000000..61d7b18 --- /dev/null +++ b/Source/cmWin32LibrariesCommand.h @@ -0,0 +1,81 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) 2000 National Library of Medicine + All rights reserved. + + See COPYRIGHT.txt for copyright details. + +=========================================================================*/ +#ifndef cmWin32LibrariesCommand_h +#define cmWin32LibrariesCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmWin32LibrariesCommand + * \brief Specify a list of libraries for Win32 platforms. + * + * cmWin32LibrariesCommand specifies a list of libraries for Win32 platforms + * only. Both user and system libraries can be listed. + */ +class cmWin32LibrariesCommand : public cmCommand +{ +public: + /** + * Constructor. + */ + cmWin32LibrariesCommand(); + + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmWin32LibrariesCommand ; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() {return true;} + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "WIN32_LIBRARIES";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add libraries that are only used for Win32 programs."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "WIN32_LIBRARIES(library -lm ...)"; + } +}; + + + +#endif diff --git a/Source/cmWin32LibrariesRule.cxx b/Source/cmWin32LibrariesRule.cxx deleted file mode 100644 index b8e082d..0000000 --- a/Source/cmWin32LibrariesRule.cxx +++ /dev/null @@ -1,41 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#include "cmWin32LibrariesRule.h" - -cmWin32LibrariesRule::cmWin32LibrariesRule() -{ -#ifndef _WIN32 - this->EnabledOff(); -#endif -} - - -// cmWin32LibrariesRule -bool cmWin32LibrariesRule::Invoke(std::vector& args) -{ - if(args.size() < 1 ) - { - this->SetError("Called with incorrect number of arguments"); - return false; - } - for(std::vector::iterator i = args.begin(); - i != args.end(); ++i) - { - m_Makefile->AddLinkLibrary((*i).c_str()); - } - return true; -} - diff --git a/Source/cmWin32LibrariesRule.h b/Source/cmWin32LibrariesRule.h deleted file mode 100644 index 038295f..0000000 --- a/Source/cmWin32LibrariesRule.h +++ /dev/null @@ -1,87 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) 2000 National Library of Medicine - All rights reserved. - - See COPYRIGHT.txt for copyright details. - -=========================================================================*/ -#ifndef cmWin32LibrariesRule_h -#define cmWin32LibrariesRule_h - -#include "cmStandardIncludes.h" -#include "cmRuleMaker.h" - -/** \class cmWin32LibrariesRule - * \brief Specify a list of libraries for Win32 platforms. - * - * cmWin32LibrariesRule specifies a list of libraries for Win32 platforms - * only. Both user and system libraries can be listed. - */ -class cmWin32LibrariesRule : public cmRuleMaker -{ -public: - /** - * Constructor. - */ - cmWin32LibrariesRule(); - - /** - * This is a virtual constructor for the rule. - */ - virtual cmRuleMaker* Clone() - { - return new cmWin32LibrariesRule ; - } - - /** - * This is called when the rule is first encountered in - * the CMakeLists.txt file. - */ - virtual bool Invoke(std::vector& args); - - /** - * This is called at the end after all the information - * specified by the rules is accumulated. - */ - virtual void FinalPass() { } - - /** - * This determines if the rule gets propagated down - * to makefiles located in subdirectories. - */ - virtual bool IsInherited() {return true;} - - /** - * The name of the rule as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "WIN32_LIBRARIES";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Add libraries that are only used for Win32 programs."; - } - - /** - * More documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "WIN32_LIBRARIES(library -lm ...)"; - } -}; - - - -#endif -- cgit v0.12