CMAKE is a program maintenance utility designed especially for the Microsoft(R) C and Microsoft Windows(TM) programmer. CMAKE is like a generic make facility in that it processes a make file in order to determine which commands need to be executed to renew a given program that is under development. However, the make file for CMAKE is much simpler than that of a generic make utility. For most cases, user-supplied dependencies are not required. CMAKE will automatically determine which commands are required by deducing all dependencies directly from the commands themselves.
Despite the fact that CMAKE must determine all dependencies for you, CMAKE executes faster than most generic make utilities running on a make file in which all dependencies have been explicitly specified.
CMAKE currently supports the following commands: CL, LIB, LINK, MASM, RC, COPY, SET and REM. The user may expand this list by defining additional commands in the CMAKE configuration file.
CMAKE is a shareware program, written and maintained by John Greschak. To become a registered user of CMAKE, send $25 to:
John Greschak 50 West 34th St. Apt. 14B8 NY, NY 10001
CMAKE was designed to run under MS-DOS(R).
Getting Started with CMAKE
Creating a Make File
Running CMAKE
Interpreting the Output of CMAKE
Error Messages
How CMAKE Works
Creating a Make File for CMAKE
Study the samples that have been included with CMAKE. Hopefully, one of these sample programs may serve as a template for your make file.
See: Samples
If you stray from the style of the samples, you might have some difficulty because CMAKE does not recognize all possible command- line formats for each command. For example, CMAKE requires that you use a response file with the commands, LIB and LINK. To guarantee success, you should become familiar with the restrictions that CMAKE imposes on the commands that you will be using in your make files.
See: Command-Line Restrictions
CL COPY LIB LINK MASM RC/A RC/C RC/W
Running CMAKE
Once you have created a make file, you will be ready to execute CMAKE. To do this, enter the command:
CMAKE /n make_file_name
Alternatively, if your make file is named "makefile" and you are in your make-file's directory, you may omit the make-file name and enter the command:
CMAKE /n
The /n option will prevent CMAKE from executing any commands from the make file. You should continue to use the /n option until CMAKE does not generate any error messages.
See: Error Messages
Once you have eliminated all CMAKE error messages, remove the /n option and execute CMAKE again. This time CMAKE will execute all of the commands that are necessary to update your application.
See: Interpreting the Output of CMAKE
At this point, you should perform some simple tests to ensure that CMAKE will generate the correct list of required commands when you modify one of your source files. (There are utility programs available that may be used to modify the time stamp of a given file. A program such as this, which is usually called "touch", provides an efficient way to modify your source files.) Modify one of your source files, execute CMAKE, and check to be sure that your application has been properly updated. Repeat this process for different source files.
If you are having difficulty in understanding why CMAKE is not updating your application properly, you might gain more insight into the cause of the problem by adding the /v option to the CMAKE command line. For example, you could use the command:
CMAKE /n /v make_file_name
The use of the /v option will cause CMAKE to generate a verbose description of its activity. This description contains detailed information concerning the processing of the make file and the configuration file (if you are using one). With the /v option, CMAKE will list all of the time stamp comparisons that it performs in route to determining which commands in the make file are required.
While you are debugging your make file, you might find it helpful to review the batch program, "makefile.bat", that CMAKE creates and executes. (Note that when the /n option is used, "makefile.bat" is created but not executed.)
Finally, you may wish to collect the output of CMAKE in a file and then review that file in you editor. To do this, you may use the MS-DOS redirection character, '>'. For example, the following command could be used to redirect the output of CMAKE to the file, "cmake.log":
CMAKE >cmake.log
See: Using CMAKE with Your Editor
Interpreting the Output of CMAKE
As CMAKE processes a given make file, it sends information concerning its activity to standard output. CMAKE supports both a concise and verbose format for this output. The default format is concise. The verbose format may be requested through the use of the /v CMAKE command-line option. This topic describes the data that is contained in the concise/default format for CMAKE output.
The first two lines of output give the current date and time, the CMAKE version number, and the copyright notice for CMAKE.
The next line has the form:
make_file_name >-CMAKE-> batch_file_name
where make_file_name is the name of the make file (input file) that CMAKE is processing and batch_file_name is the full name of the batch program (output file), "makefile.bat", that CMAKE creates and executes after processing the given make file.
This is followed by a list of all of the commands in the make file that must be executed. Each line of this list has the following form:
The first line shows that the CL command on line 2 of the make file is required because the include file, "w.h", is newer than the object file, "x.obj". The second line shows that the LIB command on line 41 of the make file is required because the object file, "x.obj" is newer than the library file, "y.lib". Finally, the third line of the list indicates that the LINK command on line 51 of the make file is required because the library file, "y.lib" is newer than the executable file, "z.exe".
This list is followed by a line that gives the amount of time used by CMAKE to create the batch program, "makefile.bat".
A line is drawn after the execution time to separate the output of CMAKE from the output of the commands that CMAKE executes.
One of the following messages is provided at the end of the output that is generated:
ALL TARGETS ARE UP TO DATE
This message indicates that CMAKE has determined that none of the commands in the make file need to be executed.
ALL TARGETS WERE SUCCESSFULLY RENEWED
This message indicates that CMAKE has determined that some of the commands in the make file were required and that all of these required commands were executed and returned zero (indicating success).
FAILURE - SOME TARGETS WERE NOT RENEWED
This indicates that some commands in the make file were required and executed. However, one of the commands returned a nonzero value (indicating an error). In this case, all of the required commands that follow the command that failed are not executed and CMAKE returns a nonzero value.
CMAKE Error Messages
The following two formats are used for CMAKE error messages:
Most of the error messages use the second format. Many popular programmer's editors (e.g. BRIEF(R), Epsilon(TM), and the Microsoft Editor) are able to parse error messages in this form in order to place you in at line 'line_number'.
See: Using CMAKE with Your Editor CMAKE Errors
How CMAKE Works
While CMAKE processes a given make file, it builds a batch program called, "makefile.bat". When it is completed, "makefile.bat" consists of all of the commands from the make file that were determined (by CMAKE) to be "required". After the make file has been fully processed, CMAKE executes "makefile.bat".
CMAKE views a command in the make file as an entity that uses source files to create target files. Generally speaking, a command will be required when one of the following conditions is true:
1. At least one of the target files for the command does not exist. 2. There is some source file for the command that is newer than some target file for the command.
A command that is determined to be required, is appended to the batch program "makefile.bat". Note that a required command will not be executed until CMAKE has processed the entire make file.
It is often the case that the target file of a given command will serve as a source file for another command that occurs later in the make file. For example, the target file of a CL command is an object file. Usually, this object file will serve as a source file for a LINK command that occurs after the CL command in the make file. If the CL command is required, then the LINK command that depends upon the object generated by the CL command, should also be required. This overlapping of the target files of one command with the source files of another command causes a "chain reaction" of required commands.
Since the required commands are not executed as they are found, but accumulated into the file, "makefile.bat" (for later use), CMAKE must keep track of all of the target files of each required command to ensure that the correct "chain reactions" occur. In some sense, CMAKE simulates the execution of each required command. It does this by creating a fresh "pseudofile" for every target file of a required command. Whenever CMAKE attempts to find the time stamp of a particular file, it first searches the set of pseudofiles. If the given file is not found among the pseudofiles, then CMAKE searches for the real/original version of the file.
The CMAKE Command Line
Syntax
CMAKE [Options]
Options
/? Displays Command-Line Help /a Displays Information about CMAKE /help Displays Help on CMAKE /n Suppresses Command Execution /o Specifies the Path of "makefile.bat" /v Select Verbose Diagnostic Output filename Specifies the Make-File Name
Example
CMAKE /v /n /oc:\test c:\test\test.mak
Examples
CMAKE
This command will cause CMAKE to attempt to process a make file called, "makefile". CMAKE will assume that "makefile" is located in the current directory. A batch program called, "makefile.bat", will be created in the current directory and CMAKE will execute this program (provided the statement, "run_output_file = no", has not been given in the CMAKE configuration file). CMAKE will use its concise output format to display information as it processes the make file.
CMAKE /od:\temp
This command will cause CMAKE to attempt to process a make file called, "makefile". CMAKE will assume that "makefile" is located in the current directory. A batch program called, "makefile.bat", will be created in the directory, "d:\temp", which has been supplied with the /o option. This program will be executed (provided the statement, "run_output_file = no", has not been given in the CMAKE configuration file). CMAKE will use its concise output format to display information as it processes the make file.
CMAKE /n /v >d:\temp\cmake.log
This command will cause CMAKE to attempt to process a make file called, "makefile". CMAKE will assume that "makefile" is located in the current directory. A batch program called, "makefile.bat", will be created in the current directory. Since the /n has been specified, CMAKE will not execute "makefile.bat". Since the /v has been specified, CMAKE will use its verbose output format to display information as it processes the make file. The output from CMAKE will be directed to the file, "d:\temp\cmake.log". The combination of options given in this example might be used to debug a make file.
CMAKE c:\mak\test.mak
This command will cause CMAKE to attempt to process a make file called, "c:\mak\test.mak". A batch program called, "makefile.bat", will be created in the current directory and CMAKE will execute this program (provided the statement, "run_output_file = no", has not been given in the CMAKE configuration file). CMAKE will use its concise output format to display information as it processes the make file.
CMAKE Options
Command-line options may be given in upper or lowercase.
With the exception of the make-file name, options must be prefixed by a '/' or '-' character.
Display Command-Line Help for CMAKE (/?)
Syntax: /?
The /? option is used to display command-line help.
Display Information about CMAKE (/a)
Syntax: /a
The /a option is used to display information on how to contact the author of CMAKE and on how to become a registered user of CMAKE.
Display Help on CMAKE (/help)
Syntax: /help or /h
The /help option is used to display the CMAKE help file you are reading. If you would like to use this option, place the QuickHelp program, QH.EXE, in your current directory or PATH.
Suppress Command Execution by CMAKE (/n)
Syntax: /n
The /n option suppresses the execution of commands. This switch takes precedence over the Boolean variable, run_output_file, which may be used in the configuration file. With this switch, the batch program, "makefile.bat", is created but not executed. You might wish to use this option to help you debug your make file.
Specify the Path of "makefile.bat" (/o)
Syntax: /o
The /o option is used to specify the path of "makefile.bat" (the batch program that CMAKE creates and executes). When the /o option is omitted, "makefile.bat" is placed in the current directory.
Select Verbose Diagnostic Output from CMAKE (/v)
Syntax: /v
The /v option is used to request the verbose format for CMAKE output. When this option is used, CMAKE provides detailed information concerning the processing of the configuration file and make file. You might wish to use this option to help you debug your make file.
Specify the Make-File Name (filename)
Syntax: filename
The filename option is used to specify the make-file name. If this option is omitted, CMAKE assumes that the make file is called, "makefile", and is located in the current directory.
The Make File for CMAKE
Description
Commands
Intrinsic Commands
CL LIB MASM REM COPY LINK RC SET
User-Defined Commands
Equivalent Commands
Unrecognized Commands
The if Statement
Comments
Description of the Make File
A make file lists the operations that are required to build a particular program.
CMAKE processes a given make file to determine which commands must be executed in order to update a program that is under development.
A make file for CMAKE consists of a mixture of commands, if statements, and comments.
The method that CMAKE uses to determine if a given command is required is dictated by the class of the command.
Intrinsic Commands
A make-file command is said to be "intrinsic" if CMAKE has some "built-in" knowledge of the how to determine whether or not the command is required.
The intrinsic commands are: CL, LIB, LINK, MASM, RC, COPY, SET, and REM.
CL
Description
When is a CL Command Required?
The CL Command Line
How CMAKE Processes a C-Source File
Switches
Some Restrictions
Error Handling
Output from CMAKE
Verbose Output from CMAKE
Description of CL
CL is a program that is distributed with the Microsoft C Optimizing Compiler. It provides a command-line interface to the compiler programs.
When is a CL Command Required?
A given CL command will be required if any of the following conditions is true:
1. The object file does not exist. 2. The source file is newer than the object file. 3. There is an include file that is newer than the object file.
These conditions are checked in order. If any condition is found to be true, the remaining conditions are not checked.
The CL Command Line
Source-File Name
Only one source-file name may be specified. No global characters are allowed in the given source-file name. The source-file name must be placed at the end of the command line. No default extension is assumed for the source file. If a path is not specified, it is assumed that the source file is located in the current directory.
Object-File Name
The base name of the object file is assumed to be the same as the base name of the source file and the object-file extension is assumed to be '.obj'. The /Fo (or equivalently, -Fo) option may be used to specify the path of the object file. If the /Fo option is used, the path that is given with this option must be terminated with a backslash. If the /Fo option is not used, it is assumed that the object file is located in the current directory.
Options
Options may appear anywhere between the CL command name and the source-file name. The /c option (compile but do not link) must be used.
When the object file of a CL command exists, and it is newer than the source file, CMAKE will process the C-source file in order to determine whether or not there is an include file that is newer than the object file. CMAKE will extract include-file names from the include statements that are given in the C-source file.
CMAKE recognizes two forms of the include statement: local and system.
Local-Include Statements
The term "local-include statement" is used to refer to an include statement that has the form:
#include "filename"
and the file associated with such an include statement is said to be a "local-include file".
System-Include Statements
The term "system-include statement" is used to refer to an include statement that has the form:
#include
and the file associated with such an include statement is said to be a "system-include file".
Sensitivity to Local- and System-Include Statements
The "sensitivity to local-include statements" and the "sensitivity to system-include statements" may be thought of as Boolean state variables for CMAKE. If the sensitivity to local-include statements is "on", and CMAKE encounters a local-include statement, CMAKE will check to see if the include file associated with the include statement is newer than the object file. Otherwise, if the sensitivity to local-include statements is "off", CMAKE will ignore the local-include statement. Likewise, if the sensitivity to system-include statements is "on", and CMAKE encounters a system-include statement, CMAKE will check to see if the include file associated with the include statement is newer than the object file. Otherwise, if the sensitivity to system- include statements is "off", CMAKE will ignore the system-include statement.
By default, the sensitivity to local-include statements is "on", and the sensitivity to system-include statements is "off".
The sensitivity to local-include statements and the sensitivity to system-include statements may be altered through the use of a variety of switches.
For each source file, CMAKE uses the Boolean variables, c_include_""_on and c_include_<>_on, to initialize the sensitivity to local- and system-include statements, respectively.
Within a given C-source file, any of the following C comments may be used to modify the sensitivity to local- or system-include statements:
/* CMAKE - INCLUDE "" OFF */ /* CMAKE - INCLUDE "" ON */ /* CMAKE - INCLUDE <> OFF */ /* CMAKE - INCLUDE <> ON */
Locating Include Files
If CMAKE does obtain an include-file name from an include statement, it will attempt to determine the directory in which the file is located. If the file is a local-include file, CMAKE will look for the file in the directory in which the source file for the given CL command is located. If the include file is not found in the source-file's directory, CMAKE will search the directories specified by the INCLUDE environment variable (if it is defined), one by one, from left to right. On the other hand, if the file is a system-include file, CMAKE will only look for the file in the directories given by the INCLUDE environment variable.
To prevent CMAKE from searching for local-include files in the source-file's directory, use the following statement in the configuration file:
search_source_dir_for_includes = no
Scanning Include Files for Include Statements
By default, CMAKE does not scan include files for include statements. To force CMAKE to scan include files for include statements, place the following statement in your configuration file:
scan_include_files_for_includes = yes
Alternatively, you may place the following commands anywhere within your make file (except within the body of an if statement) to achieve a "local" effect:
REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES ON REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES OFF
When a REM statement of this type is used, all of the CL commands that follow the statement will be affected.
The End-of-Includes Comment
If CMAKE encounters the comment:
/* CMAKE - INCLUDE END */
while scanning a C-source file, it will stop processing the file, i.e. CMAKE will not read any lines in the source file that occur after this comment.
Although it is not required, you should place this comment after the last include statement in any C-source files that will be scanned by CMAKE. If you do this, you will reduce the amount of time that CMAKE takes to execute.
The Procedure Used to Examine a C-Source File
For a given CL command, CMAKE uses the following process to scan the C-source file in order to determine whether or not there is an include file that is newer than the object file:
A. Initialize the sensitivity to local-include statements and system-include statements.
B. Read a line from the source file.
C. If we are at the end of the source file
Go to step G - there are no include files in this source file that are newer than the object file.
D. Skip leading white space on the line.
E. If the line begins with the comment /* CMAKE - INCLUDE "" ON */
Enable the sensitivity to local-include statements.
Else if the line begins with the comment /* CMAKE - INCLUDE "" OFF */
Disable the sensitivity to local-include statements.
Else if the line begins with the comment /* CMAKE - INCLUDE <> ON */
Enable the sensitivity to system-include statements.
Else if the line begins with the comment /* CMAKE - INCLUDE <> OFF */
Disable the sensitivity to system-include statements.
Else if the line begins with the comment /* CMAKE - INCLUDE END */
Go to step G - there are no include files in this source file that are newer than the object file.
Else if the line begins with the character, '#'
1. Skip white space following the '#' character.
2. If the next token is 'include'
a. Skip white space following the 'include' token.
b. If (the next character is '"' and the sensitivity to local includes is on) or (the next character is '<' and the sensitivity to system includes is on)
i. Copy the include-file name.
ii. If the include file is local and the configuration data specifies that we must search for include files in the source-file directory
Search for the include file in the source-file directory (the full include-file name is obtained by prefixing the source-file path to the include-file name derived from the source file).
iii. If the include file has not yet been found
Search for the include file in the paths given by the INCLUDE environment variable.
iv. If the include file is newer than the object file
Go to step G - there is an include file that is newer than the object file.
Else if the configuration data specifies that we must scan include files for include statements
Save the include-file name
F. Go to step B
G. If we must scan include files for include statements and an include file that is newer than the object file has not yet been found
For each saved include file, repeat the process given above (beginning with step A) with the include file playing the role of the source file. Continue until all saved include files have been examined or an include file that is newer than the object file is found.
Switches for CL
The following switches may be used to affect the way in which CMAKE processes a CL command:
/* CMAKE - INCLUDE END */
C comment statement in C-source or -include files. Used to indicate that there are no include statements after the comment.
scan_include_files_for_includes
Boolean variable set in the configuration file. Used to indicate whether or not CMAKE should scan include files for include statements. (Default: no).
REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES ON REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES OFF
Make file commands. Used to indicate whether or not CMAKE should scan include files for include statements. These commands take precedence over the Boolean variable, scan_include_files_for_includes, which may be set in the configuration file.
search_source_dir_for_includes
Boolean variable set in the configuration file. Used to indicate whether or not CMAKE should look for local-include files in the source-file's directory before using the INCLUDE environment variable. (Default: yes).
c_include_""_on c_include_<>_on
Boolean variables set in the configuration file. Used to control the initial sensitivity for each source file to local- and system- include statements. c_include_""_on (Default: yes). c_include_<>_on (Default: no)
/* CMAKE - INCLUDE "" OFF */ /* CMAKE - INCLUDE "" ON */ /* CMAKE - INCLUDE <> OFF */ /* CMAKE - INCLUDE <> ON */
C comment statements in C-source or -include files. Used to modify the sensitivity to local- and system-include statements. The effect of these switches is local. They only affect the processing of the source file in which they are contained. These switches take precedence over the Boolean variables, c_include_""_on and c_include_<>_on, which may be set in the configuration file.
Some Restrictions on CL
Preprocessor Directives
#include is the only preprocessor directive that CMAKE recognizes. One of the implications of this is that CMAKE will not ignore conditionally compiled include statements based upon whether or not a particular identifier has been defined (either with a #define statement or through the use of the /D CL command-line option). For example, in the following section of source code, if the sensitivity to local-include statements is on, CMAKE will not skip the include statement - regardless of whether or not the identifier, INCLUDE_TEST_H, has been defined:
#ifdef INCLUDE_TEST_H #include "test.h" #endif
Any of the following approaches could be taken to instruct CMAKE to ignore this include statement:
#ifdef INCLUDE_TEST_H /* CMAKE - INCLUDE "" OFF */ #include "test.h" /* CMAKE - INCLUDE "" ON */ #endif
The full path of an include file may not be given in an include statement (i.e. the include-file name must not begin with a drive or a '\' character). However, relative paths may be used (i.e. the include-file name may begin with dots (..) or a directory name).
Error Handling with CL
If a CL command is required, CMAKE will add the CL command to the batch file, "makefile.bat". In addition, CMAKE will insert the following command after the CL command:
if errorlevel 1 goto failed
This will ensure that if the CL command fails (i.e. returns a nonzero value), "makefile.bat" will terminate.
Output from CMAKE for CL
Normally, CMAKE provides no information on the processing of a given CL command unless the command is required. If the command is required, one of the following messages will appear:
OBJ object_file Does Not Exist
This indicates that does not exist.
SRC source_file > OBJ
This indicates that is newer than the object file.
INC include_file > OBJ object_file
This indicates that is newer than .
Examples
cl 35 OBJ test.obj Does Not Exist cl 35 SRC test.c > OBJ cl 35 INC test.h > OBJ test.obj
Verbose Output from CMAKE for CL
When the verbose output format is selected, CMAKE lists all of the time stamp comparisons that it makes in route to determining if a given CL command is required.
Source File is older than Object File Include File test1.h is older than Object File Include File test2.h is older than Object File Include File test3.h is older than Object File
Source File is older than Object File Include File test1.h is older than Object File ***** Include File test2.h is NEWER than Object File
Modified Command Line:
cl /c /W3 test.c if errorlevel 1 goto failed
* REQUIRED *
COPY
Description
The COPY Command Line
When is a COPY Command Required?
Some Restrictions
Error Handling
Output from CMAKE
Verbose Output from CMAKE
Description of COPY
COPY is an internal MS-DOS command. It is used to copy one or more files from one location to another.
The COPY Command Line
The COPY command must be of the following form:
copy source target
Both and are required. and may be a file or directory (but not a root directory). If (or ) is a file, and the path of the file is not specified, it is assumed that the file is located in the current directory.
When is a COPY Command Required?
The conditions under which a given COPY command (of the form: copy source target) will be required, depend upon the "type" of the COPY command. There are four possible types:
Type
Type ff file file Type fd file directory Type df directory file Type dd directory directory
Regardless of the "type" of the COPY command, if does not exist, the COPY command will be required. Otherwise, the conditions are as follows:
Type ff: copy source_file target_file
If the source file is newer than the target file, the COPY command will be required
Type fd: copy source_file target_directory
The target-file name is constructed from the target directory name and the source-file name. If the target file does not exist, or if the source file is newer than the target file, the COPY command will be required.
Type df: copy source_directory target_file
The COPY command will always be required in this case.
Type dd: copy source_directory target_directory
If the source directory is empty, the COPY command will not be required. Otherwise, for each file, , in the source directory, the corresponding target-file name is constructed from and . If does not exist, or if is newer than , the following COPY command will be required:
copy source_file target_file
Some Restrictions on COPY
Global Characters
The source and target names may not contain the global characters, '*' and '?'.
Concatenation
CMAKE does not support the concatenation operator, '+', for the COPY command.
Options
Options (e.g. /A, /B, and /V) may only be placed after the target name. White space must be placed between the target name and the first option. The options, /A and /B, may not be used after the source name.
Reserved Device Names
The reserved device names: PRN, LPT1, LPT2, LPT3, CON, COM1, COM2, COM3, COM4, and AUX, may be used for source and target names. However, the results will be predictable. Regardless of whether or not the source name is a reserved device name, if the target name is a reserved device name, the COPY command will not be required. If the source name is a reserved device name, and the target name is not a reserved device name, the COPY command will be required.
Error Handling with COPY
CMAKE will usually insert the following command into the batch file, "makefile.bat", after a required command:
if errorlevel 1 goto failed
However, this is not done in the case of the COPY command because the COPY command does not return a nonzero value when it fails.
Output from CMAKE for COPY
Normally, CMAKE provides no information on the processing of a given COPY command unless the command is required. If the command is required, one of the following messages will appear:
TRG target_file Does Not Exist
This indicates that does not exist.
SRC source_file > TRG target_file
This indicates that is newer than .
SRC source_dir is a Directory and TRG target_file is a File
This indicates that the source of the COPY command is a directory and the target is a file. (This form of the COPY command is always required.)
Examples
copy 12 TRG test.trg Does Not Exist copy 12 SRC test.src > TRG test.trg copy 12 SRC \s is a Directory and test.trg is a File
Verbose Output from CMAKE for COPY
When the verbose output format is selected, CMAKE lists all of the time stamp comparisons that it makes in route to determining if a given COPY command is required.
In the following two examples, "\s" and "\t" are directories, and the files in the directory, "\s", are: "1.txt", "2.txt", "3.txt", "4.txt", and "5.txt".
Source File \s\1.txt is older or equal to Target File \t\1.txt Source File \s\2.txt is older or equal to Target File \t\2.txt Source File \s\3.txt is older or equal to Target File \t\3.txt Source File \s\4.txt is older or equal to Target File \t\4.txt Source File \s\5.txt is older or equal to Target File \t\5.txt
***** Source File \s\1.txt is NEWER than Target File \t\1.txt Source File \s\2.txt is older or equal to Target File \t\2.txt ***** Target File \t\3.txt Does Not Exist Source File \s\4.txt is older or equal to Target File \t\4.txt ***** Source File \s\5.txt is NEWER than Target File \t\5.txt
* REQUIRED *
Note:
In this example, the following commands would be written to the batch file, "makefile.bat":
LIB is a program that is distributed with the Microsoft C Optimizing Compiler and the Microsoft Macro Assembler. It is used to create and maintain library files.
When is a LIB Command Required?
A given LIB command will be required if any of the following conditions is true:
1. The library file does not exist. 2. A component file (object or library) is newer than the library file.
These conditions are checked in order. If any condition is found to be true, the remaining conditions are not checked.
The LIB Command Line
Examples: A Library of Objects A Library of Libraries
Command Line
The library-file name, component files (objects or libraries), and options must be specified in a LIB response file. The first non- white-space character that follows the LIB command name must be '@'. This character must be followed by a response-file name. White space is allowed between the character, '@', and the response-file name. The response-file name may be followed by white space or a semicolon. If the path of the response file is not specified, it is assumed that the response file is located in the current directory.
Response File
The library-file name must be placed at the beginning of the first line of the response file. White space may precede the library- file name. No default extension is assumed for the library file. If the path of the library is not specified, it is assumed that the library is located in the current directory. All LIB options must be placed after the library-file name. White space must be used to separate the library-file name and the first option.
The letter, 'y', must be placed on the second line of the response file. This is used as the answer to the LIB prompt: "Library does not exist. Create? (y/n)", in the case where the library does not exist. White space may precede and follow the character, 'y'.
The last section of the response file consists of the set of component-file names. CMAKE accepts two formats for this list. The list may contain either a set of object files or a set of library files. Regardless of the format used, each line in this section may contain only one file name. Each file name must be preceded by an operation. If the list contains a set of objects, each object-file name must be preceded by the "replace" command symbol, '-+'. If the list contains a set of libraries, each library-file name must be preceded by the "add" command symbol, '+'. White space may be placed before the command symbols, between the '-' and '+' characters of the '-+' command symbol, and between the command symbol and the component-file name. No default extension is assumed for the component files. If the path of a component file is not specified, it is assumed that the component file is located in the current directory. Except for the last component in the list, each component-file name must be followed by the character, '&'. White space is allowed between a component-file name and the character, '&'. The last component- file name in the list of components should not be followed by the character, '&'.
CMAKE ignores all lines in the response file that occur after the line that contains the last component-file name.
Example: A Library of Objects
command: lib @test.lrf
where "test.lrf" is a LIB response file with the following lines:
test.lib /I y -+test1.obj & -+test2.obj ;
Example: A Library of Libraries
command: lib @test.lrf
where "test.lrf" is a LIB response file with the following lines:
test.lib /I y +test1.lib & +test2.lib ;
Modified Command Line for LIB
If a LIB command is required, CMAKE will add the LIB command to the batch file, "makefile.bat".
If the library consists of a set of objects, CMAKE will create a new LIB response file that contains only those object files that are newer than the library. The new LIB response file will have the same name as the original, except that the extension, '.clb', will be used in place of the original response-file extension.
If the library consists of a set of component libraries, and the library (into which the components are to be placed) exists, CMAKE will insert the following command into the batch file, "makefile.bat", before the LIB command:
erase library_file
Note that in this case, since the library is a conglomerate of component libraries that are added (+) together, the library must be erased, and rebuilt from scratch.
Error Handling with LIB
If a LIB command is required, CMAKE will insert the following command into the batch file, "makefile.bat", after the LIB command:
if errorlevel 1 goto failed
This will ensure that if the LIB command fails (i.e. returns a nonzero value), "makefile.bat" will terminate.
Some Restrictions on LIB
Response-File Name
If the response file consists of a list of objects, the extension of the LIB response-file name may not be '.clb'
Cross-Reference-Listing File and Output Library
If a cross-reference-listing file and output library file are specified in the LIB response file, they will not be included in the new response file that CMAKE creates in the case where the response file consists of a list of objects.
Output from CMAKE for LIB
Normally, CMAKE provides no information on the processing of a given LIB command unless the command is required. If the command is required, one of the following messages will appear:
When the verbose output format is selected, CMAKE lists all of the time stamp comparisons that it makes in route to determining if a given LIB command is required.
The next two examples illustrate the verbose output generated for cases where the LIB response file consists of a set of objects. For these examples, the LIB response file, "test.lrf", consists of the following lines:
test.lib y -+test1.obj & -+test2.obj ;
Examples: A Library of Objects: LIB Not Required A Library of Objects: LIB Required
The next two examples illustrate the verbose output generated for cases where the LIB response file consists of a set of libraries. For these examples, the LIB response file, "test.lrf", consists of the following lines:
test.lib y +test1.lib & +test2.lib ;
Examples: A Library of Libraries: LIB Not Required A Library of Libraries: LIB Required
Component-Library File test1.lib is older than Library File ***** Component-Library File test2.lib is NEWER than Library File
Modified Command Line:
erase test.lib lib @test.lrf if errorlevel 1 goto failed
* REQUIRED *
LINK
Description
When is a LINK Command Required?
The LINK Command Line
Error Handling
Output from CMAKE
Verbose Output from CMAKE
Description of LINK
LINK is a program that is distributed with the Microsoft C Optimizing Compiler and the Microsoft Macro Assembler. It is used to build executable files and dynamic-link libraries.
When is a LINK Command Required?
A given LINK command will be required if any of the following conditions is true:
1. The executable file does not exist. 2. A component-object file is newer than the executable file. 3. A component-library file is newer than the executable file. 4. The module-definition file is newer than the executable file.
These conditions are checked in order. If any condition is found to be true, the remaining conditions are not checked.
The LINK Command Line
Examples: Linking Objects Linking with Libraries Using a Module-Definition File
Command Line
The executable-file name, component-object files, component- library files, module-definition file, and options must be specified in a LINK response file. The first non-white-space character that follows the LINK command name must be '@'. This character must be followed by a response-file name. White space is allowed between the character, '@', and the response-file name. The response-file name may be followed by white space or a semicolon. If the path of the response file is not specified, it is assumed that the response file is located in the current directory.
Response File
Each line of the response file may contain only one file name. White space may precede the file name given on any line.
The first section of the response file must consist of a list of object files. No default extension is assumed for the object files. If the path of an object is not specified, it is assumed that the object is located in the current directory. Except for the last object in the list, each object-file name must be followed by the character, '+'. White space is allowed between an object-file name and the character, '+'. The last object-file name in the list of objects must not be followed by the character, '+'.
The line that follows the last object must begin with the name of the executable file. LINK options may be placed on this line, after the executable-file name. White space must be used to separate the executable-file name and the first option. If a map file is not desired, there are no component libraries, and there is no module-definition file, a semicolon must be placed at the end of the line that contains the executable-file name.
If a semicolon has not been used at the end of the executable-file line, the line that follows the executable name must contain the map-file name. If there are no component libraries and there is no module-definition file, a semicolon must be placed at the end of the line that contains the map-file name. If a map file is not desired, and there are component libraries or there is a module- definition file, either use NUL for the map-file name or leave the map-file line blank.
If there are component libraries, they must be listed after the line that contains the map-file name. No default extension is assumed for library files. If the path of a library is not specified, it is assumed that the library is located in the current directory. (CMAKE does not use the LIB environment variable to search for libraries.) Except for the last library in the list, each library-file name must be followed by the character, '+'. White space is allowed between the library-file name and the character, '+'. The last library-file name in the list of must not be followed by the character, '+'. If there is no module-definition file, a semicolon must be placed at the end of the line that contains the last library-file name.
If there is a module-definition file, the line that follows the last library must contain the module-definition-file name. A semicolon may be placed at the end of the module-definition-file line. However, the semicolon is not required in this case.
CMAKE ignores all lines in the response file that occur after the line that contains the semicolon or the line that contains the module-definition-file name, whichever comes first.
Example: Linking Objects
command: link @test.lnk
where "test.lnk" is a LINK response file with the following lines:
If a LINK command is required, CMAKE will add the LINK command to the batch file, "makefile.bat". In addition, CMAKE will insert the following commands after the LINK command:
if errorlevel 1 goto n_link_failed goto n_link_ok if exist executable_file erase executable_file goto failed
This will ensure that if the LINK command fails (i.e. returns a nonzero value), the faulty executable that LINK may have created will be erased, and "makefile.bat" will terminate. (Actually, in place of the prefix, 'n_', used in the batch file labels given above, CMAKE will use a numeric prefix (e.g. 2_link_failed) that is ensured to be unique across all required LINK commands.)
Output from CMAKE for LINK
Normally, CMAKE provides no information on the processing of a given LINK command unless the command is required. If the command is required, one of the following messages will appear:
EXE executable_file Does Not Exist
This indicates that does not exist.
OBJ object_file > EXE executable_file
This indicates that is newer than .
LIB library_file > EXE executable_file
This indicates that is newer than .
DEF module_definition_file > EXE executable_file
This indicates that is newer than .
Examples
link 38 EXE test.exe Does Not Exist link 38 OBJ test.obj > EXE test.exe link 38 LIB test.lib > EXE test.exe link 38 DEF test.def > EXE test.exe
Verbose Output from CMAKE for LINK
When the verbose output format is selected, CMAKE lists all of the time stamp comparisons that it makes in route to determining if a given LINK command is required.
For both of the examples given below, the LINK response file, "test.lnk", is as follows:
Command: link Parameters: @test.lnk Command Type: intrinsic Command ID: 2
Response File: test.lnk Executable File: test.exe
Object File test.obj is older than Executable File Library File test.lib is older than Executable File Module-Definition File test.def is older than Executable File
* not required *
Example: LINK Required
link @test.lnk
Command: link Parameters: @test.lnk Command Type: intrinsic Command ID: 2
Response File: test.lnk Executable File: test.exe
***** Object File test.obj is NEWER than Executable File
Modified Command Line:
link @test.lnk if errorlevel 1 goto 0_link_failed goto 0_link_ok :0_link_failed if exist test.exe erase test.exe goto failed :0_link_ok
* REQUIRED *
MASM
Description
When is a MASM Command Required?
The MASM Command Line
How CMAKE Processes an Assembly-Language-Source File
Switches
Some Restrictions
Error Handling
Output from CMAKE
Verbose Output from CMAKE
Description of MASM
MASM is a program that is distributed with the Microsoft Macro Assembler. In Macro Assembler versions prior to 6.00, MASM is the assembler itself. In version 6.00 of the Macro Assemble, MASM provides a command-line interface to the assembler program, ML.EXE.
When is a MASM Command Required?
A given MASM command will be required if any of the following conditions is true:
1. The object file does not exist. 2. The source file is newer than the object file. 3. There is an include file that is newer than the object file.
These conditions are checked in order. If any condition is found to be true, the remaining conditions are not checked.
The MASM Command Line
Source-File Name
The source-file name must be placed before the first comma on the command line. Only white space may be present between the source- file name and the comma that follows it. No default extension is assumed for the source file. If a path is not specified, it is assumed that the source file is located in the current directory.
Object-File Name
The object-file name must be specified. It must be placed after the first comma on the command line. Only white space may be present between the object-file name and the comma that precedes it. No default extension is assumed for the object file. If a path is not specified, it is assumed that the object file is located in the current directory. The object-file name may be followed by a comma, semicolon, or white space.
Options
Options may not be placed between the source-file name and the first comma or between the first comma and the object-file name.
How CMAKE Processes an Assembly-Language-Source File
When the object file of a MASM command exists, and it is newer than the source file, CMAKE will process the assembly-language- source file in order to determine whether or not there is an include file that is newer than the object file. CMAKE will extract include-file names from the include statements that are given in the assembly-language-source file.
Sensitivity to Include Statements
The "sensitivity to include statements" may be thought of as a Boolean state variable for CMAKE. If the sensitivity to include statements is "on" and CMAKE encounters an include statement, CMAKE will check to see if the include file associated with the include statement is newer than the object file. Otherwise, if the sensitivity to include statements is "off", CMAKE will ignore the include statement.
By default, the sensitivity to include statements is "on".
The sensitivity to include statements may be altered through the use of a variety of switches.
For each source file, CMAKE uses the Boolean variable, asm_include_on, to initialize the sensitivity to include statements.
Within a given assembly-language-source file, the following comments may be used to modify the sensitivity to include statements:
; CMAKE - INCLUDE OFF ; CMAKE - INCLUDE ON
Locating Include Files
If CMAKE does obtain an include-file name from an include statement, it will attempt to determine the directory in which the file is located. First, CMAKE will look for the file in the current directory. If the include file is not found in the current directory, CMAKE will look for the file in the directory in which the source file for the given MASM command is located. If the include file is not found in the source-file's directory, CMAKE will search the directories specified by the INCLUDE environment variable (if it is defined), one by one, from left to right.
To prevent CMAKE from searching for include files in the current directory, use the following statement in the configuration file:
search_current_dir_for_includes = no
To prevent CMAKE from searching for include files in the source- file's directory, use the following statement in the configuration file:
search_source_dir_for_includes = no
Scanning Include Files for Include Statements
By default, CMAKE does not scan include files for include statements. To force CMAKE to scan include files for include statements, place the following statement in your configuration file:
scan_include_files_for_includes = yes
Alternatively, you may place the following commands anywhere within your make file (except within the body of an if statement) to achieve a "local" effect:
REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES ON REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES OFF
When a REM statement of this type is used, all of the MASM commands that follow the statement will be affected.
The End-of-Includes Comment
If CMAKE encounters the comment:
; CMAKE - INCLUDE END
while scanning an assembly-language-source file, it will stop processing the file, i.e. CMAKE will not read any lines in the source file that occur after this comment.
Although it is not required, you should place this comment after the last include statement in any assembly-language-source file that will be scanned by CMAKE. If you do this, you will reduce the amount of time that CMAKE takes to execute.
The Procedure Used to Examine an Assembly-Language-Source File
For a given MASM command, CMAKE uses the following process to scan the assembly-language-source file in order to determine whether or not there is an include file that is newer than the object file:
A. Initialize the sensitivity to include statements.
B. Read a line from the source file.
C. If we are at the end of the source file
Goto step G - there are no include files in this source file that are newer than the object file.
D. Skip leading white space on the line.
E. If the line begins with the comment ; CMAKE - INCLUDE ON
Enable the sensitivity to include statements.
Else if the line begins with the comment ; CMAKE - INCLUDE OFF
Disable the sensitivity to include statements.
Else if the line begins with the comment ; CMAKE - INCLUDE END
Go to step G - there are no include files in this source file that are newer than the object file.
Else if the line begins with the token, 'include' (or 'INCLUDE'), and the sensitivity to include statements is on
1. Skip white space following the 'include' token.
2. Copy the include-file name.
3. If the configuration data specifies that we must search for include files in the current directory
Search for the include file in the current directory (the full include-file name is obtained by prefixing the current directory to the include-file name derived from the source file).
4. If the include file has not yet been found and the configuration data specifies that we must search for include files in the source-file directory
Search for the include file in the source-file directory (the full include-file name is obtained by prefixing the source-file path to the include- file name derived from the source file).
5. If the include file has not yet been found
Search for the include file in the paths given by the INCLUDE environment variable.
6. If the include file is newer than the object file
Go to step G - there is an include file that is newer than the object file.
Else if the configuration data specifies that we must scan include files for include statements
Save the include-file name
F. Go to step B
G. If we must scan include files for include statements and an include file that is newer than the object file has not yet been found
For each saved include file, repeat the process given above (beginning with step A) with the include file playing the role of the source file. Continue until all saved include files have been examined or an include file that is newer than the object file is found.
Switches for MASM
The following switches may be used to affect the way in which CMAKE processes a MASM command:
; CMAKE - INCLUDE END
Assembly-language-comment statement in source or include files. Used to indicate that there are no include statements after the comment.
scan_include_files_for_includes
Boolean variable set in the configuration file. Used to indicate whether or not CMAKE should scan include files for include statements. (Default: no).
REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES ON REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES OFF
Make file commands. Used to indicate whether or not CMAKE should scan include files for include statements. These commands take precedence over the Boolean variable, scan_include_files_for_includes, which may be set in the configuration file.
search_source_dir_for_includes
Boolean variable set in the configuration file. Used to indicate whether or not CMAKE should look for include files in the source- file's directory before using the INCLUDE environment variable. (Default: yes).
search_current_dir_for_includes
Boolean variable set in the configuration file. Used to indicate whether or not CMAKE should look for include files in the current directory before using the INCLUDE environment variable. (Default: yes).
asm_include_on
Boolean variable set in the configuration file. Used to control the initial sensitivity for each source file to include statements. (Default: yes)
; CMAKE - INCLUDE OFF ; CMAKE - INCLUDE ON
Assembly-language-comment statements in source or include files. Used to modify the sensitivity to include statements. The effect of this switch is local. It only affects the processing of the source file in which it is are contained. This switch takes precedence over the Boolean variable, asm_include_on which may be set in the configuration file.
Some Restrictions on MASM
Include Statements
The full path of an include file may not be given in an include statement (i.e. the include-file name must not begin with a drive or a '\' character). However, relative paths may be used (i.e. the include-file name may begin with dots (..) or a directory name).
Error Handling with MASM
If a MASM command is required, CMAKE will add the MASM command to the batch file, "makefile.bat". In addition, CMAKE will insert the following command after the MASM command:
if errorlevel 1 goto failed
This will ensure that if the MASM command fails (i.e. returns a nonzero value), "makefile.bat" will terminate.
Output from CMAKE for MASM
Normally, CMAKE provides no information on the processing of a given MASM command unless the command is required. If the command is required, one of the following messages will appear:
OBJ object_file Does Not Exist
This indicates that does not exist.
SRC source_file > OBJ
This indicates that is newer than the object file.
INC include_file > OBJ object_file
This indicates that is newer than .
Examples
masm 37 OBJ test.obj Does Not Exist masm 37 SRC test.asm > OBJ masm 37 INC test.h > OBJ test.obj
Verbose Output from CMAKE for MASM
When the verbose output format is selected, CMAKE lists all of the time stamp comparisons that it makes in route to determining if a given MASM command is required.
Source File is older than Object File Include File test1.inc is older than Object File Include File test2.inc is older than Object File Include File test3.inc is older than Object File
Source File is older than Object File Include File test1.inc is older than Object File ***** Include File test2.inc is NEWER than Object File
Modified Command Line:
masm /W2 /V /Z test.asm,test.obj; if errorlevel 1 goto failed
* REQUIRED *
RC
Description
Operations
RC/C - Compile a Resource-Script File
RC/A - Add a Resource File to an Executable File
RC/W - Add the Windows Version Stamp to a File
RC/CA - Compile and Add a Resource File to an Executable File
Description of RC
RC is a program that is distributed with the Microsoft Windows Software Development Kit. It is known as the "Resource Compiler".
RC Operations
The Resource Compiler may be used to perform any of the following four operations:
Compile a Resource-Script File
Compile a resource-script file to create a resource file. We use the symbol, "RC/C", to represent an RC command that is used for this purpose. (The suffix, '/C', stands for "Compile".)
Add a Resource File to an Executable File
Add a resource file to an executable file. We use the symbol, "RC/A", to represent an RC command that is used for this purpose. (The suffix, '/A', stands for "Add".)
Add the Windows Version Stamp to a File
Add the Windows version stamp to a file generated by the linker. We use the symbol, "RC/W", to represent an RC command that is used for this purpose. (The suffix, '/W', stands for "Windows".)
Compile and Add a Resource File to an Executable File
Compile a resource-script file to create a resource file, and add the resulting resource file to an executable file. We use the symbol, "RC/CA", to represent an RC command that is used for this purpose. (The suffix, '/CA', stands for "Compile and Add".)
CMAKE supports the first three of these four operations.
RC/C
Description Helpful Hints
The RC/C Command Line
When is an RC/C Command Required?
How CMAKE Processes a Resource-Script File
Switches
Some Restrictions
Error Handling
Output from CMAKE
Verbose Output from CMAKE
Description of RC/C
We use the symbol, "RC/C", to represent an RC command that is used to compile a resource-script file in order to create a resource file. The suffix, '/C', stands for "Compile".
The RC/C Command Line
Resource-Script-File Name
The resource-script-file name must be the last command-line parameter. No default extension is assumed for the resource- script file. If the path of the resource-script file is not specified, it is assumed that the file is located in the current directory.
If your editor has the capability to allow you to review compiler error message, and you use this feature, you should use the path separator, '/' (or '\\') (in place of the usual, '\'), in the resource-script-file name. If this is not done, RC will drop the path separators from the resource-script-file name that it provides in error messages that pertain to that file. The end result will be that your editor will be unable to open the resource-script file when an error occurs in that file. CMAKE supports the use of, '/' and '\\', in place of the usual, '\', in this case. However, the path separator, '\', should be used in all other paths that are specified in the make file. (The problem described above is present in the "Microsoft Windows Resource Compiler Version 3.00 (dated 6/1/90)". More recent versions of the Resource Compiler may or may not have this problem.)
Resource-File Name
The /fo option may be used to specify the name of the resource file. If this option is used, the resource-file-name extension must be specified; and the path of the resource file must be specified, if the file is not located in the current directory.
If the /fo option is not used, the resource-file name is derived from the resource-script-file name by replacing the resource- script-file-name extension with '.res'.
Options
Options may appear anywhere between the RC command name and the resource-script-file name. The /r option (compile) must be used. The /r option may not be combined with another single letter option. The options, /r and /fo, are not case sensitive, and '-' may be used in place of '/'.
A given RC/C command will be required if any of the following conditions is true:
1. The resource file does not exist. 2. The resource-script file is newer than the resource file. 3. There is an include file or included resource (e.g. an icon, bitmap, cursor, font, or user-defined resource) that is newer than the resource file.
How CMAKE Processes a Resource-Script File
When the resource file of an RC/C command exists, and it is newer than the resource-script file, CMAKE will process the resource- script file in order to determine whether or not there is an include file or an included resource (e.g. an icon, bitmap, cursor, font, or user-defined resource) that is newer than the resource file. CMAKE will extract include-file names from the include statements and resource-include statements that are given in the resource-script file.
CMAKE recognizes two forms of the include statement: local and system. CMAKE also recognizes resource-include statements.
Local-Include Statements
The term "local-include statement" is used to refer to an include statement that has the form:
#include "filename"
and the file associated with such an include statement is said to be a "local-include file".
System-Include Statements
The term "system-include statement" is used to refer to an include statement that has the form:
#include
and the file associated with such an include statement is said to be a "system-include file".
Resource-Include Statements
The term "resource-include statement" is used to refer to a statement that has the form:
and the file associated with such a statement is said to be a "resource-include file" or an "included resource". (Note that the documentation for the Microsoft Windows Software Development Kit refers to these statements as "single-line" statements.) Some examples of resource-include statements are:
Sensitivity to Local-, System-, and Resource-Include Statements
The "sensitivity to local-include statements", the "sensitivity to system-include statements", and the "sensitivity to resource- include statements" may be thought of as Boolean state variables for CMAKE.
If the sensitivity to local-include statements is "on", and CMAKE encounters a local-include statement, CMAKE will check to see if the include file associated with the include statement is newer than the object file. Otherwise, if the sensitivity to local- include statements is "off", CMAKE will ignore the local-include statement. Similar statements may be made to describe the role of the sensitivity to "system-" include statements and the sensitivity to "resource-" include statements.
By default, the sensitivity to local-include statements is "on", the sensitivity to system-include statements is "off", and the sensitivity to resource-include statements is "on".
The sensitivity to local-, system-, and resource-include statements may be altered through the use of a variety of switches.
For each source file, CMAKE uses the Boolean variables, rc_include_""_on, rc_include_<>_on, and rc_include_resource_on to initialize the sensitivity to local-, system-, and resource- include statements, respectively.
Within a given resource-script file, any of the following C-style comments may be used to modify the sensitivity to local-, system-, or resource-include statements:
/* CMAKE - INCLUDE "" OFF */ /* CMAKE - INCLUDE "" ON */ /* CMAKE - INCLUDE <> OFF */ /* CMAKE - INCLUDE <> ON */ /* CMAKE - INCLUDE RESOURCE OFF */ /* CMAKE - INCLUDE RESOURCE ON */
Locating Include Files
If CMAKE does obtain an include-file name from an include statement, it will attempt to determine the directory in which the file is located. If the file is a local-include file or a resource-include file, CMAKE will look for the file in the current directory. If the include file is not found in the current directory, CMAKE will search the directories specified by the INCLUDE environment variable (if it is defined), one by one, from left to right. On the other hand, if the file is a system-include file, CMAKE will only look for the file in the directories given by the INCLUDE environment variable.
To prevent CMAKE from searching for local-include files and resource-include files in the current directory, use the following statement in the configuration file:
search_current_dir_for_includes = no
Scanning Include Files for Include Statements
By default, CMAKE does not scan include files for include statements. To force CMAKE to scan local-include files and system-include files for include statements, place the following statement in your configuration file:
scan_include_files_for_includes = yes
Alternatively, you may place the following commands anywhere within your make file (except within the body of an if statement) to achieve a "local" effect:
REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES ON REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES OFF
When a REM statement of this type is used, all of the RC/C commands that follow the statement will be affected.
The End-of-Includes Comment
If CMAKE encounters the comment:
/* CMAKE - INCLUDE END */
while scanning a resource-script file, it will stop processing the file, i.e. CMAKE will not read any lines in the file, that occur after this comment. To learn how this switch may be used to affect the way in which CMAKE processes the resource-script file,
See: Helpful Hints for RC/C
The Procedure Used to Examine a Resource-Script File
For a given RC/C command, CMAKE uses the following process to scan the resource-script file in order to determine whether or not there is an include file that is newer than the resource file:
A. Initialize the sensitivity to local-include statements, system-include statements, and resource-include statements.
B. Read a line from the resource-script file.
C. If we are at the end of the resource-script file
Goto step G - there are no include files or included resources in this resource-script file that are newer than the resource file.
D. Skip leading white space on the line.
E. If the line begins with the character, '/'
If the line begins with the comment /* CMAKE - INCLUDE "" ON */
Enable the sensitivity to local-include statements.
Else if the line begins with the comment /* CMAKE - INCLUDE "" OFF */
Disable the sensitivity to local-include statements.
Else if the line begins with the comment /* CMAKE - INCLUDE <> ON */
Enable the sensitivity to system-include statements.
Else if the line begins with the comment /* CMAKE - INCLUDE <> OFF */
Disable the sensitivity to system-include statements.
Else if the line begins with the comment /* CMAKE - INCLUDE RESOURCE ON */
Enable the sensitivity to resource-include statements.
Else if the line begins with the comment /* CMAKE - INCLUDE RESOURCE OFF */
Disable the sensitivity to resource-include statements.
Else if the line begins with the comment /* CMAKE - INCLUDE END */
Go to step G - there are no include files or included resources in this resource-script file that are newer than the resource file.
Else if the line begins with the character, '#'
1. Skip white space following the '#' character.
2. If the next token is 'include'
a. Skip white space following the 'include' token.
b. If (the next character is '"' and the sensitivity to local includes is on) or (the next character is '<' and the sensitivity to system includes is on)
i. Copy the include-file name.
ii. If the include file is local and the configuration data specifies that we must search for include files in the current directory
Search for the include file in the current directory (the full include-file name is obtained by prefixing the current directory to the include-file name derived from the resource-script file).
iii. If the include file has not yet been found
Search for the include file in the paths given by the INCLUDE environment variable.
iv. If the include file is newer than the resource file
Go to step G - there is an include file that is newer than the resource-script file.
Else if the configuration data specifies that we must scan include files for include statements
Save the include-file name.
Else if the sensitivity to resource includes is on
1. Skip to the end of the line or to the first ' occurrence of, '//' or '/*', whichever comes first.
2. Copy the file name of the included resource from the previous token (convert any occurrences of, '\\' and '/', in the file name, to '\').
3. If the configuration data specifies that we must search for include files in the current directory
Search for the included resource in the current directory (the full file name for the included resource is obtained by prefixing the current directory to the resource-include-file name derived from the resource-script file).
4. If the included resource has not yet been found
Search for the included resource in the paths given by the INCLUDE environment variable.
5. If the included resource is newer than the resource file
Go to step G - there is an included resource that is newer than the resource file.
F. Go to step B
G. If we must scan include files for include statements and an include file or included resource that is newer than the resource file has not yet been found
For each saved (local- or system-) include file, repeat the process given above (beginning with step A) with the include file playing the role of the resource-script file. Continue until all saved include files have been examined, or an include file is found that is newer than the resource file.
Switches for RC/C
The following switches may be used to affect the way in which CMAKE processes an RC/C command:
/* CMAKE - INCLUDE END */
C-style comment statement in resource-script file or (local- or system-) include files. Used to indicate that there are no local-, system-, or resource-include statements after the comment.
scan_include_files_for_includes
Boolean variable set in the configuration file. Used to indicate whether or not CMAKE should scan include files for include statements. (Default: no).
REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES ON REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES OFF
Make file commands. Used to indicate whether or not CMAKE should scan include files for include statements. These commands take precedence over the Boolean variable, scan_include_files_for_includes, which may be set in the configuration file.
search_current_dir_for_includes
Boolean variable set in the configuration file. Used to indicate whether or not CMAKE should look for local- and resource-include files in the current directory, before using the INCLUDE environment variable. (Default: yes).
Boolean variables set in the configuration file. Used to control the initial sensitivity for each resource-script file to local-, system-, and resource-include statements. rc_include_""_on (Default: yes). rc_include_<>_on (Default: no). rc_include_resource_on (Default: yes).
/* CMAKE - INCLUDE "" OFF */ /* CMAKE - INCLUDE "" ON */ /* CMAKE - INCLUDE <> OFF */ /* CMAKE - INCLUDE <> ON */ /* CMAKE - INCLUDE RESOURCE OFF */ /* CMAKE - INCLUDE RESOURCE ON */
C-style comment statements in resource-script file or (local- or system-) include files. Used to modify the sensitivity to local-, system-, and resource-include statements. The effect of these switches is local. They only affect the processing of the file in which they are contained. These switches take precedence over the Boolean variables, rc_include_""_on, rc_include_<>_on, and rc_include_resource_on, which may be set in the configuration file.
Some Restrictions on RC/C
Preprocessor Directives
#include is the only preprocessor directive that CMAKE recognizes. One of the implications of this is that CMAKE will not ignore conditionally compiled include statements based upon whether or not a particular identifier has been defined (either with a #define statement or through the use of the /D RC command-line option). For example, in the following section of source code, if the sensitivity to local-include statements is on, CMAKE will not skip the include statement - regardless of whether or not the identifier, INCLUDE_TEST_H, has been defined:
#ifdef INCLUDE_TEST_H #include "test.h" #endif
Any of the following approaches could be taken to instruct CMAKE to ignore this include statement:
#ifdef INCLUDE_TEST_H /* CMAKE - INCLUDE "" OFF */ #include "test.h" /* CMAKE - INCLUDE "" ON */ #endif
The full path of a local-, system-, or resource-include file may not be given in an include statement (i.e. the include-file name must not begin with a drive or a '\' character). However, relative paths may be used (i.e. the include-file name may begin with dots (..) or a directory name).
Note that if a path is used in the file name of an included resource, '/' or '\\' must be used in place of the usual path separator, '\'. For example, you would use
myicon ICON "..\\ico\\myicon.ico"
or
myicon ICON "../ico/myicon.ico"
in place of
myicon ICON "..\ico\myicon.ico"
This restriction is imposed by the Resource Compiler, itself. (The behavior described above was observed in the "Microsoft Windows Resource Compiler Version 3.00 (dated 6/1/90)". More recent versions of the Resource Compiler may or may not behave this way.)
Error Handling with RC/C
If an RC/C command is required, CMAKE will add the RC/C command to the batch file, "makefile.bat". In addition, CMAKE will insert the following command after the RC/C command:
if errorlevel 1 goto failed
This will ensure that if the RC/C command fails (i.e. returns a nonzero value), "makefile.bat" will terminate.
Output from CMAKE for RC/C
Normally, CMAKE provides no information on the processing of a given RC/C command unless the command is required. If the command is required, one of the following messages will appear:
RES resource_file Does Not Exist
This indicates that does not exist.
SRC resource_script_file > RES
This indicates that is newer than the resource file.
INC include_file > RES resource_file
This indicates that is newer than .
Examples
rc 35 RES test.res Does Not Exist rc 35 SRC test.rc > RES rc 35 INC test.h > RES test.res rc 35 INC test.ico > RES test.res
Verbose Output from CMAKE for RC/C
When the verbose output format is selected, CMAKE lists all of the time stamp comparisons that it makes in route to determining if a given RC/C command is required.
Resource-Script File is older than Resource File Include File test1.h is older than Resource File Include File test2.h is older than Resource File Include File test.ico is older than Resource File
Resource-Script File is older than Resource File Include File test1.h is older than Resource File Include File test2.h is older than Resource File ***** Include File test.ico is NEWER than Resource File
Modified Command Line:
rc /v /r test.rc if errorlevel 1 goto failed
* REQUIRED *
Helpful Hints for RC/C
Controlling Resource-Script File Processing
When the sensitivity to resource-include statements is "on", CMAKE assumes that each line that it reads from the resource-script file, that does not begin with, '/' or '#' (and is not blank), is a resource-include statement.
But generally, not every line in a resource-script file, that does not begin with, '#' or '/', will be a resource-include statement (there will usually be some multiple-line statements such as MENU or DIALOG statements present in the resource-script file as well).
To prevent CMAKE from misinterpreting a line in the resource- script file as a resource-include statement, you could place all of your include statements at the top of the resource-script file, and place the following comment in your script file after the section that contains the include statements:
/* CMAKE - INCLUDE END */
More specifically, you could take the following approach:
1. If a heading (consisting of comments) is desired in the resource-script file, begin each comment line with, '//' or '/*'. 2. Place all #include statements and statements that include resources (such as icons, bitmaps, cursors, fonts, and user- defined resources) after any comments placed at the top of the resource-script file. 3. Place the comment, "/* CMAKE - INCLUDE END */", after the section of the resource-script file that contains the #include statements and statements that are used to include resources.
When the sensitivity to resource-include statements is "off", CMAKE ignores all lines in the resource-script file that do not begin with, "#include" or "/* CMAKE -". Thus, CMAKE will not misinterpret any lines in the resource-script file as resource- include statements, when the sensitivity to resource-include statements is "off". To take advantage of this fact, you could use the following switches in your resource-script file:
/* CMAKE - INCLUDE RESOURCE OFF */ /* CMAKE - INCLUDE RESOURCE ON */
These switches may be used to turn the sensitivity to resource- include statements, "off" and "on", respectively.
RC/A
Description
The RC/A Command Line
When is an RC/A Command Required?
Error Handling
Output from CMAKE
Verbose Output from CMAKE
Description of RC/A
We use the symbol, "RC/A", to represent an RC command that is used to add a resource file to an executable file. The suffix, '/A', stands for "Add".
The RC/A Command Line
Resource-File Name
The resource-file name must be the last or second-to-last command -line parameter. The resource-file name must have the extension, '.res'. If the path of the resource file is not specified, it is assumed that the resource file is located in the current directory.
Executable-File Name
If the resource-file name is the last command-line parameter, the executable-file name is derived from the resource-file name by replacing the file extension, '.res', with '.exe'.
If the resource-file name is the second to last command-line parameter, the executable-file name must be the last command-line parameter. In this case, no default extension will be assumed for the executable file. If the path of the executable file is not specified, it will be assumed that the executable file is located in the current directory.
CMAKE does not recognize the /fe option which may be used to rename the executable file.
A given RC/A command will be required if any of the following conditions is true:
1. A previous make-file command for which the executable file is a target (e.g. LINK), is required. 2. A previous make-file command for which the resource file is a target (e.g. RC/C), is required.
These conditions are checked in order. If any condition is found to be true, the remaining conditions are not checked.
Error Handling with RC/A
If an RC/A command is required, CMAKE will add the RC/A command to the batch file, "makefile.bat". In addition, CMAKE will insert the following commands after the RC/A command:
if errorlevel 1 goto n_rc_failed goto n_rc_ok if exist executable_file erase executable_file goto failed
This will ensure that if the RC/A command fails (i.e. returns a nonzero value), the faulty executable file will be erased, and "makefile.bat" will terminate. (Actually, in place of the prefix, 'n_', used in the batch file labels given above, CMAKE will use a numeric prefix (e.g. 2_rc_failed) that is ensured to be unique across all required RC commands.)
Output from CMAKE for RC/A
Normally, CMAKE provides no information on the processing of a given RC/A command unless the command is required. If the command is required, one of the following messages will appear:
EXE executable_file Has Been Updated
This indicates that a previous make-file command for which is a target file (e.g. LINK), is required.
RES resource_file Has Been Updated
This indicates that a previous make-file command for which is a target file (e.g. RC/C), is required.
Examples
rc 37 EXE test.exe Has Been Updated rc 37 RES test.res Has Been Updated
Verbose Output from CMAKE for RC/A
When the verbose output format is selected, CMAKE lists all of the time stamp comparisons that it makes in route to determining if a given RC/A command is required.
Executable File Has Not Been Updated ***** Resource File Has Been Updated
Modified Command Line:
rc /v test.res test.exe if errorlevel 1 goto 0_rc_failed goto 0_rc_ok :0_rc_failed if exist test.exe erase test.exe goto failed :0_rc_ok
* REQUIRED *
RC/W
Description
The RC/W Command Line
When is an RC/W Command Required?
Error Handling
Output from CMAKE
Verbose Output from CMAKE
Description of RC/W
We use the symbol, "RC/W", to represent an RC command that is used to add the Windows version stamp to a file. The suffix, '/W', stands for "Windows".
The RC/W Command Line
We refer the file to which we would like to add the Windows version stamp, as the "target file".
Target-File Name
The target-file name must be the last command-line parameter. If there are two or more command-line parameters, the second to last command-line parameter must be an option. No default extension is assumed for the target file. The target file may not have the extension, '.res'. If the path of the target file is not specified, it is assumed that the target file is located in the current directory.
A given RC/W command will be required if the target file of the RC/W command is also the target of a previous make-file command that is required.
Error Handling with RC/W
If an RC/W command is required, CMAKE will add the RC/W command to the batch file, "makefile.bat". In addition, CMAKE will insert the following commands after the RC/W command:
if errorlevel 1 goto n_rc_failed goto n_rc_ok if exist target_file_name erase target_file_name goto failed
This will ensure that if the RC/W command fails (i.e. returns a nonzero value), the faulty target file of RC/W will be erased, and "makefile.bat" will terminate. (Actually, in place of the prefix, 'n_', used in the batch file labels given above, CMAKE will use a numeric prefix (e.g. 2_rc_failed) that is ensured to be unique across all required RC commands.)
Output from CMAKE for RC/W
Normally, CMAKE provides no information on the processing of a given RC/W command unless the command is required. If the command is required, the following message will appear:
TRG target_file Has Been Updated
This indicates that a previous make-file command for which is a target file (e.g. LINK), is required.
Examples
rc 39 TRG test.dll Has Been Updated
Verbose Output from CMAKE for RC/W
When the verbose output format is selected, CMAKE lists all of the time stamp comparisons that it makes in route to determining if a given RC/W command is required.
rc /v test.dll if errorlevel 1 goto 1_rc_failed goto 1_rc_ok :1_rc_failed if exist test.dll erase test.dll goto failed :1_rc_ok
* REQUIRED *
RC/CA
CMAKE does not support this operation.
REM
Description
REM is an MS-DOS command. It is used to add comments to DOS batch programs.
When is a REM Command Required?
REM commands are never required.
The REM Command Line
CMAKE imposes no restrictions on the REM command.
Switches
The following two REM commands have a special meaning to CMAKE:
REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES ON REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES OFF
These commands may be used to indicate whether or not CMAKE should scan C, assembly-language, and resource-script include files for include statements. These switches remain in effect until the end of the make file or until another such REM switch is encountered. These commands take precedence over the Boolean variable, scan_include_files_for_includes, which may be set in the configuration file.
Output from CMAKE
Normally, CMAKE provides no information on the processing of REM commands.
Verbose Output from CMAKE
When the verbose output format is selected, CMAKE will list each REM command and indicate that the command is not required.
For example, if the command, "rem TEST.EXE", is used in the make file, CMAKE will generate the following output:
rem TEST.EXE
Command: rem Parameters: TEST.EXE Command Type: intrinsic (comment)
* not required *
SET
Description
SET is an internal MS-DOS command. It is used to display, set, or remove MS-DOS environment variables.
When is a SET Command Required?
SET commands are always required.
The SET Command Line
CMAKE supports the following two forms of the SET command:
set set environment_variable_name=environment_variable_value
Error Handling
Ordinarily, CMAKE will insert the following command into the batch file, "makefile.bat", after a command that is required:
if errorlevel 1 goto failed
However, this is not done for the SET command because the SET command does not return a nonzero value when it fails.
Output from CMAKE
Normally, CMAKE provides the following information for every SET command:
always required
For example, if there is a SET command on line 10 of the make file, CMAKE will generate the following output:
set 10 always required
Verbose Output from CMAKE
When the verbose output format is selected, CMAKE will list each SET command and indicate that the command is required.
For example, if the command, "set include=..\h;c:\c\include", is used in the make file, CMAKE will generate the following output:
set include=..\h;c:\c\include
Command: set Parameters: include=..\h;c:\c\include Command Type: intrinsic Command ID: 5
Environment Variable Name: INCLUDE Environment Variable Value: ..\h;c:\c\include
* REQUIRED *
User-Defined Commands
Description
When is a User-Defined Command Required?
The Command Line for a User-Defined Command
How CMAKE Processes the Command Line of a User-Defined Command
Predefined Pseudofiles
Error Handling
Output from CMAKE
Verbose Output from CMAKE
Description of User-Defined Commands
User-defined commands are commands that the user has added to CMAKE's vocabulary through the use of command-definition statements in the configuration file. A command-definition statement instructs CMAKE on how to determine if a given user- defined command is required.
See: Command-Definition Statements
When is a User-Defined Command Required?
A given user-defined command will be required if one of the following conditions is true:
1. At least one target file does not exist. 2. There is a source file that is newer than some target file.
The Command Line for a User-Defined Command
White space must follow all source and target-file names.
How CMAKE Processes the Command Line of a User-Defined Command
The source and target files for a given user-defined command are extracted from the command line by using the command-definition configuration statement for the user-defined command. In a way, the command-definition statement serves as a "prototype" for the user-defined command (similar to the way in which a function declaration can serve as a "prototype" for a given C language function). The command-definition statement provides a list of stationary parameters and a list of floating parameters. Usually, each stationary and floating parameter is used to specify the format for a particular source or target file will be given on the command line for the user-defined command. Each stationary and floating parameter will be of the form
parameter_prefix%file_type_code
where file_type_code indicates whether the file is a source file or target file (note that the file may also be specified as neutral), and parameter_prefix is the prefix that will precede the file name on the command line (note that the parameter prefix may be null).
For each command-line parameter, CMAKE scans the list of floating parameters (from left to right) until a floating parameter is found that has a prefix that matches the beginning of the current command-line parameter. If a matching floating parameter is not found, the prefix of the current stationary parameter is compared with the beginning of the current command-line parameter. (The current stationary parameter is the first stationary parameter in the list of stationary parameters that has not yet been used to obtain a file name from the command line.) (CMAKE considers a null prefix to be a match for anything.)
If a matching floating or stationary parameter is not found, the command-line parameter is skipped. Otherwise, the file type (source, target, or neutral) is obtained from the file type code ('s', 't', or 'n') at the end of the matching stationary or floating parameter. If the file is a neutral file, the command- line parameter is skipped. If the file is a source or target file, CMAKE obtains the time stamp for the file. (Actually, if it has already been established that the user-defined command is required (i.e. there is a target file that does not exist, or there is a source file that is newer that some target file), CMAKE will not obtain the time stamp of the file.)
The process described above is carried out for each command-line parameter, until either
1. all command-line parameters have been examined, or 2. the list of floating parameters is empty and all stationary parameters have been used to obtain a file name from the command line.
Predefined Pseudofiles for User-Defined Commands
"start.psf"
The file name, "start.psf", may be used as a source or target file within any user-defined command. You may think of "start.psf" as a file that is created just before CMAKE begins processing the make file. The sole purpose of "start.psf" is to mark this point in time. (We refer to "start.psf" as a pseudofile because this file is never actually created.)
Examples
For each example given below, it is assumed that the following command-definition statement has been provided in the configuration file:
command_definition : newcmd sp[%s %t]
Using "start.psf" as a Source File
The following command:
newcmd start.psf test.trg
will be required only if there are no required commands that occur before it for which "test.trg" is a target file.
Using "start.psf" as a Target File
The following command:
newcmd test.src start.psf
will be required only if there is a required command that occurs before it for which "test.src" is a target file.
Error Handling with User-Defined Commands
If a user-defined command is required, CMAKE will add the user- defined command to the batch file, "makefile.bat". In addition, CMAKE will insert the following command after the user-defined command:
if errorlevel 1 goto failed
This will ensure that if the user-defined command fails (i.e. returns a nonzero value), "makefile.bat" will terminate.
Output from CMAKE for User-Defined Commands
Normally, CMAKE provides no information on the processing of a given user-defined command unless the command is required. If the command is required, one of the following messages will appear:
TRG target_file Does Not Exist
This indicates that does not exist.
SRC source_file > TRG target_file
This indicates that is newer than .
Examples
cmd1 21 TRG test.trg Does Not Exist cmd2 22 SRC test.src > TRG test.trg
Verbose Output from CMAKE for User-Defined Commands
For a user-defined command, if the verbose output format is selected, CMAKE will list all of the source, target, and neutral files that are derived from the command line. For each file listed, CMAKE will indicate which stationary or floating parameter was used to obtain the file.
For each example given below, it is assumed that the following command-definition statement has been provided in the configuration file:
command_definition : newcmd sp[%s %s] fp[/o%t]
Examples: User-Defined Command Not Required User-Defined Command Required
Example: User-Defined Command Not Required
newcmd /otest.trg test1.src test2.src
Command: newcmd Parameters: /otest.trg test1.src test2.src Command Type: user defined Command ID: 2
***** Source File test2.src is NEWER than Target File test.trg
Modified Command Line:
newcmd /otest.trg test1.src test2.src if errorlevel 1 goto failed
* REQUIRED *
Equivalent Commands
Description
How CMAKE Processes an Equivalent Command
Output from CMAKE
Verbose Output from CMAKE
Description of Equivalent Commands
Equivalent commands are commands that the user has added to CMAKE's vocabulary through the use of command-equivalence statements in the configuration file. A command-equivalence statement specifies that a given command should be treated exactly like another given intrinsic or user-defined command.
See: Command-Equivalence Statements
How CMAKE Processes an Equivalent Command
A given command that has been defined to be equivalent to some intrinsic or user-defined command (referred to here as the equivalent command) is treated exactly like the equivalent command. That is to say:
1. The command will be required if and only if the equivalent command is required. 2. Any restrictions that apply to the equivalent command will also apply to the given command. 3. Any error handling (e.g. "if errorlevel 1 goto failed") that is used with the equivalent command, will also be used with the given command.
Output from CMAKE for Equivalent Commands
Normally, the output for CMAKE for the given command will be identical to that of the equivalent command, except that the given command name will appear in place of the equivalent-command name.
Verbose Output from CMAKE for Equivalent Commands
The verbose output format for a given command will be identical to that of the equivalent command, except that the name and type (intrinsic or user-defined) of the equivalent command will be provided.
For each example given below, it is assumed that the following command-equivalence statement has been provided in the configuration file:
command_equivalence : spasm = masm
Examples: Equivalent Command Not Required Equivalent Command Required
spasm /W2 /V /Z test.asm,test.obj; if errorlevel 1 goto failed
* REQUIRED *
Unrecognized Commands in the Make File
Description
Unrecognized commands are the commands that are not intrinsic, user-defined, or equivalent.
When is an Unrecognized Command Required?
Unrecognized commands are always required.
The Command Line for an Unrecognized Command
CMAKE imposes no restrictions on the command line of an unrecognized command.
Error Handling
Since unrecognized commands are required (unconditionally), CMAKE will add each unrecognized command to the batch file, "makefile.bat". CMAKE does not insert any error handling commands (e.g. "if errorlevel 1 goto failed") after an unrecognized command. Thus, "makefile.bat" will not terminate when an unrecognized command fails.
Output from CMAKE
Normally, CMAKE provides the following information for every unrecognized command:
unrecognized
For example, if an unrecognized command called, "whatcmd", is used in the make file, CMAKE will provide the following output:
whatcmd 21 unrecognized
Verbose Output from CMAKE
When the verbose output format is selected, CMAKE will list each unrecognized command and indicate that the command is required.
For example, if the command, "whatcmd test.src test.trg", is used in the make file, and "whatcmd" is an unrecognized command, CMAKE will generate the following output:
When are the Commands in the Body of an if Statement Required?
Predefined Pseudofiles
Error Handling
Output from CMAKE
Verbose Output from CMAKE
Description of the if Statement
The if statement is used in a make file to explicitly specify source/target file dependencies. It is an extension of the target/dependent description blocks which are used with most generic make utilities.
Syntax of the if Statement
An if statement has one of the following general forms:
Within the if statement, white space is ignored (except between file names, where it is required). The target-file names must be listed before the source-file names, and the character, '<', must be used to separate the set of target-file names from the set of source-file names. Each command within the body of an if statement must appear on a separate line. The brackets ({}) are required only in the case where the body of the if statement consists of more than one command.
Examples
/***************************************************************** * The brackets, '{' and '}', are optional when the body of an * if statement consists of only one command: *****************************************************************/
if ( 1.trg < 1.src 2.src ) echo hello
/***************************************************************** * The brackets, '{' and '}', are required when the body of an * if statement consists of more than one command: *****************************************************************/
if ( 1.trg 2.trg < 1.src 2.src ) { echo hello echo world }
/***************************************************************** * Since white space is ignored, the lists of source- and target- * file names may be given in a variety of formats: *****************************************************************/
if ( 1.trg 2.trg < 1.src 2.src ) { echo hello echo world }
/***************************************************************** * You may not place the closing bracket, '}', at the end of the * last command in the body of an if statement. The following * example shows an unacceptable location for the closing bracket: *****************************************************************/
if ( 1.trg < 1.src ) { echo hello }
/***************************************************************** * In this last example, CMAKE would assume that the closing * bracket, '}', is part of the ECHO command line. *****************************************************************/
When are the Commands in the Body of an if Statement Required?
The commands within the body of a given if statement will be required if one of the following conditions is true:
1. At least one target file does not exist. 2. There is a source file that is newer than some target file.
Examples
if ( 1.trg < 1.src 2.src ) { echo These echo commands will be required if the target file, echo "1.trg", does not exist, or at least one of the source echo files, "1.src" and "2.src", is newer than the target echo file, "1.trg". }
if ( 1.trg 2.trg < 1.src 2.src ) { echo These echo commands will be required if any of the echo following conditions is true: echo. echo 1. The target file, "1.trg", does not exist. echo 2. The target file, "2.trg", does not exist. echo 3. The source file, "1.src", is newer than "1.trg". echo 4. The source file, "1.src", is newer than "2.trg". echo 5. The source file, "2.src", is newer than "1.trg". echo 6. The source file, "2.src", is newer than "2.trg". }
Predefined Pseudofiles for the if Statement
"start.psf"
The file name, "start.psf", may be used as a source or target file within any if statement. You may think of "start.psf" as a file that is created just before CMAKE begins processing the make file. The sole purpose of "start.psf" is to mark this point in time. (We refer to "start.psf" as a pseudofile because this file is never actually created.)
Examples
Using "start.psf" as a Source File
if ( test.trg < start.psf )
{ echo These echo commands will be required only if there are no echo required commands that occur before this if statement for echo which "test.trg" is a target file. }
Using "start.psf" as a Target File
if ( start.psf < test.src )
{ echo These echo commands will be required only if there is a echo required command that occurs before this if statement for echo which "test.src" is a target file. }
Error Handling with the if Statement
If the commands within the body of a given if statement are required, CMAKE will add all of the commands to the batch file, "makefile.bat". In addition, CMAKE will insert the following command after each required command:
if errorlevel 1 goto failed
This will ensure that if any command within the body of the if statement fails (i.e. returns a nonzero value), "makefile.bat" will terminate.
Output from CMAKE for the if Statement
Normally, CMAKE provides no information on the processing of a given if statement unless the commands within the body of the if statement are required. If the commands are required, each of the commands within the body of the if statement will be listed with one of the following messages:
TRG target_file Does Not Exist
This indicates that does not exist.
SRC source_file > TRG target_file
This indicates that is newer than .
Examples
cmd 21 TRG test.trg Does Not Exist cmd 21 SRC test.src > TRG test.trg
Verbose Output from CMAKE for the if Statement
For each example given below, it is assumed that the following if statement has been given in the make file:
if ( test1.trg test2.trg < test1.src test2.src test3.src )
***** Source File test3.src is NEWER than Target File test1.trg
Modified Command Line(s):
echo hello if errorlevel 1 goto failed echo good bye if errorlevel 1 goto failed
* REQUIRED *
Comments in the Make File
C-style comments (/* */) and C++-style comments (//) may be used to annotate a make file. A comment is treated as a single white- space character, but is otherwise ignored.
The comment delimiters, /* and //, are not permitted after the command name on a command line.
Examples
Suppose that we have a make file that consists of the following two commands:
cl /c /W4 hello.c cl /c /W4 world.c
We could "comment out" the command, "cl /c /W4 world.c", by adding comment delimiters around the command:
cl /c /W4 hello.c /*cl /c /W4 world.c*/
Another acceptable approach would be:
cl /c /W4 hello.c /* cl /c /W4 world.c */
We could also use a C++-style comment to obtain the same result:
cl /c /W4 hello.c // cl /c /W4 world.c
An unacceptable way to "comment out" the command, "cl /c /W4 world.c", would be:
cl /c /W4 hello.c /* cl /c /W4 world.c */
In this case, CMAKE would assume that the comment delimiter, '/*', is part of the command, "cl /c /W4 hello.c". In fact, since '/*' is the last token on the command line, '/*' would be taken to be the source-file name for the CL command!
Another unacceptable comment would be:
cl /c /W4 hello.c // This is an unacceptable comment cl /c /W4 world.c
In this case, CMAKE would take the word, "comment", to be the source-file name of the command, "cl /c /W4 hello.c".
The CMAKE Configuration File
Description
How CMAKE Locates the Configuration File
The Section Tag
Statements
Comments
Assignment Statements
Command-Definition Statements
Command-Equivalence Statements
Description of the Configuration File
A configuration file may be used with CMAKE in order to alter default switch settings, define new commands, and set up command equivalences. You may execute CMAKE without a configuration file if you are satisfied with the default settings and do not need to enlarge CMAKE's command table.
Example
; cmake.cfg - CMAKE configuration file
[CMAKE]
; Assignment statements scan_include_files_for_includes = no search_source_dir_for_includes = yes search_current_dir_for_includes = yes c_include_""_on = yes c_include_<>_on = no asm_include_on = yes rc_include_""_on = yes rc_include_<>_on = no rc_include_resource_on = yes run_output_file = yes display_output_file_commands = no display_execution_time = yes
When CMAKE begins, it attempts to locate and load its configuration file. CMAKE uses the following process to locate the configuration file:
1. If the environment variable, CMAKE_CFG, is defined, its value is used for the configuration-file name. 2. If the environment variable, CMAKE_CFG, is not defined, or the configuration file given by, CMAKE_CFG, does not exist, CMAKE looks for the file, "cmake.cfg", in the current directory. 3. If "cmake.cfg" is not found in the current directory, CMAKE looks for "cmake.cfg" in the directory in which CMAKE.EXE is located. 4. If "cmake.cfg" is not found in the directory in which CMAKE.EXE is located, CMAKE assumes that there is no configuration file, and as a result, will use default settings for all Boolean variables.
Note that the environment variable, CMAKE_CFG, should not be defined with a SET command in the make file because CMAKE loads the configuration file before it begins processing the make file.
Verbose Output from CMAKE
When the verbose output format is selected, CMAKE lists the locations where it attempts to find the configuration file. It will also indicate whether or not the configuration file has been found.
Example:
CMAKE_CFG Environment Variable: CMAKE_CFG is undefined Current Directory: c:\test\cmake.cfg does not exist CMAKE.EXE Directory: configuration file c:\c\cmake.cfg found
The CMAKE Section Tag in the Configuration File
CMAKE ignores all lines in the configuration until a line is found that begins with the section tag, [CMAKE]. CMAKE will process all lines that follow the section tag, until a line is found that begins with '[' (indicating the beginning of another section in the configuration file) or the end-of-file is reached.
Because of the use of section tags, the configuration data for CMAKE may be placed in a file that contains initialization data for other applications. For example, the configuration data for CMAKE could be placed in the file, "tools.ini", which is used with the Microsoft Editor or in the file, "win.ini", which is used with Microsoft Windows. Bear in mind that if the configuration data for CMAKE is placed at the end of a long file, CMAKE will become sluggish.
Configuration-File Statements
The configuration data for CMAKE consists of single-line statements.
Leading white space is ignored on every line of the configuration file.
Comments in the Configuration File
CMAKE ignores any line in the configuration file that begins with the character, ';'.
Assignment Statements in the Configuration File
Syntax
Boolean Variables
Verbose Output from CMAKE
Syntax of Assignment Statements
Assignment statements have the following form:
Boolean_variable_name = value
where 'Boolean_variable_name' is the name of a Boolean variable and 'value' must be either yes or no. White space is ignored between the variable name and the value.
Indicates whether or not CMAKE should scan include files for include statements. The following commands, which may be used in the make file, take precedence over this Boolean variable:
REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES ON REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES OFF
Default: no
search_source_dir_for_includes
Indicates whether or not CMAKE should look for include files in the source-file's directory before using the INCLUDE environment variable.
Default: yes
search_current_dir_for_includes
Indicates whether or not CMAKE should look for include files in the current directory before using the INCLUDE environment variable.
Default: yes
c_include_""_on
Controls the initial sensitivity to local-include statements, for each C-source file. Within a given C-source file, the following comments may be used to override the value of this Boolean variable:
/* CMAKE - INCLUDE "" OFF */ /* CMAKE - INCLUDE "" ON */
Default: yes
c_include_<>_on
Controls the initial sensitivity to system-include statements, for each C-source file. Within a given C-source file, the following comments may be used to override the value of this Boolean variable:
/* CMAKE - INCLUDE <> OFF */ /* CMAKE - INCLUDE <> ON */
Default: no
asm_include_on
Controls the initial sensitivity to include statements, for each assembly-language-source file. Within a given assembly-language- source file, the following comments may be used to override the value of this Boolean variable:
; CMAKE - INCLUDE OFF ; CMAKE - INCLUDE ON
Default: yes
rc_include_""_on
Controls the initial sensitivity to local-include statements, for each resource-script file. Within a given resource-script file, the following comments may be used to override the value of this Boolean variable:
/* CMAKE - INCLUDE "" OFF */ /* CMAKE - INCLUDE "" ON */
Default: yes
rc_include_<>_on
Controls the initial sensitivity to system-include statements, for each resource-script file. Within a given resource-script file, the following comments may be used to override the value of this Boolean variable:
/* CMAKE - INCLUDE <> OFF */ /* CMAKE - INCLUDE <> ON */
Default: no
rc_include_resource_on
Controls the initial sensitivity to resource-include statements, for each resource-script file. Within a given resource-script file, the following comments may be used to override the value of this Boolean variable:
/* CMAKE - INCLUDE RESOURCE OFF */ /* CMAKE - INCLUDE RESOURCE ON */
Default: yes
run_output_file
Determines whether or not the batch file, "makefile.bat", is to be executed. The command-line option, /n, takes precedence over this Boolean variable.
Default: yes
display_output_file_commands
Controls whether or not the commands in the batch file, "makefile.bat", are displayed as they are executed. Note that the output from each executed command is always displayed. This switch only determines whether or not the commands themselves are also displayed. The value of this variable is irrelevant if the variable, run_output_file, is 'no'.
Default: no
display_execution_time
Controls whether or not CMAKE reports its execution time. This time is the number of seconds that it takes CMAKE to create the batch file, "makefile.bat". It does not include the time required to execute this batch file. This time is displayed in the both the concise and verbose CMAKE output formats.
Default: yes
Verbose Output from CMAKE for Assignment Statements
When the verbose output format is selected, CMAKE will list each assignment statement that it finds in the configuration file.
For example, if the assignment statement, "search_source_dir_for_includes = no", is used in the configuration file, CMAKE will generate the following output:
search_source_dir_for_includes = no
Command: search_source_dir_for_includes Parameters: no Command Type: assignment Command ID: 0
Command-Definition Statements
Command-definition statements may be used to expand CMAKE's command table. Each command-definition statement provides information on how to determine when a particular command is required. The command-definition statement tells CMAKE which files, listed in the command's parameters, are source files (i.e. files that the command uses), and which files are target files (i.e. files that the command creates)
Syntax
The general form of the command-definition configuration statement is:
command_definition : command_name sp[...] fp[...]
White space between 'command_definition' and the command name is ignored.
The command name is required. Command names may be up to 8 characters long and should not include-file-name extensions such as '.bat', '.com', or '.exe'. Command names are not case sensitive. There must be space between the command name and 'sp' (or between the command name and 'fp', if 'sp' is omitted).
sp[...] and fp[...] are used to specify stationary (sp) and floating (fp) command parameters, respectively. The stationary parameters of a command are those that always appear in a certain position on the command line. Generally, floating parameters are those parameters that are identified by a certain option prefix (e.g. -fo), and may appear anywhere on the command line. sp[...] and fp[...] are both optional and may appear in any order. Each may be used at most once in a command-definition statement. The brackets, '[' and ']', are required. A space may not be placed between 'sp' or 'fp' and the opening bracket, '['. White space is not required between the closing bracket, ']', and 'sp' or 'fp' that follows the bracket.
The stationary and floating parameters are specified with a parameter description string of tokens, where each token must be of the form:
parameter_prefix%file_type_code
The parameter description string may be up to 20 characters long. White space placed before the first token and after the last token of the parameter description string is ignored. Space must be placed between any two tokens.
The parameter prefix is optional. If a prefix is given, it must begin with a non-white-space character and cannot contain the character, '%'. The parameter prefix may contain white space.
The file type delimiter, '%', is required.
The file type codes are single character codes used to indicate whether a file is a source file, target file, or neutral. The valid file type codes are
's' (source) 't' (target) 'n' (neutral)
White space may not be placed between the file type delimiter, '%', and file type code.
The subsection entitled, "User-Defined Commands", under "The Make File" section of this help file describes exactly how CMAKE uses a command-definition statement to determine if a given command is required.
See: User-Defined Commands
Examples
Example 1
Consider the command, IMPLIB. (IMPLIB is a utility that is distributed with the Microsoft C Optimizing Compiler. It is used to create import libraries.) The syntax of the IMPLIB command is:
IMPLIB import_library module_definition_file
Implib uses the module-definition file to create an import library.
Without a command-definition statement for IMPLIB, CMAKE will not recognize the IMPLIB command. In this case, since unrecognized commands are always required, IMPLIB would always be required.
The following command-definition statement could be used to tell CMAKE that the IMPLIB command should only be required when the module-definition file is newer than the import library file.
command_definition : implib sp[%t %s]
This statement tells CMAKE that the IMPLIB command has two stationary parameters (sp), and that the first stationary parameter gives the name of the target file that IMPLIB creates (%t), and the second stationary parameter gives the name of the source file that IMPLIB uses (%s).
Example 2
Suppose the following command-definition statement is included in the configuration file:
command_definition : cmd1 fp[/FI%s /FO%t]
With this command definition in place, the following command (which would be placed in the make file):
CMD1 /A /FOtest.obj /B /FItest.c /C
will only be required when "test.obj" does not exist, or when "test.c" is newer than "test.obj".
Example 3
Not all programs allow us to specify the names of all their source and target files on the command line.
For the sake of discussion, let REVERSE be a program that reverses a given text file. Further, suppose that the output of the REVERSE is always called, "reversed.txt". For example, the command:
REVERSE test.txt
would generate the file, "reversed.txt", which would be the reversed version of "test.txt".
Since REVERSE is an unrecognized command, REVERSE will always be required. We might wish to have the REVERSE command only be required when "test.txt" is newer than "reversed.txt".
Since CMAKE cannot deduce the source and target files names from the REVERSE command line, we could not use a command-definition statement (for REVERSE) for this purpose.
However, we could create a batch file called, "rev.bat", with the following command:
REVERSE %1
and supply the command-definition statement:
command_definition : rev sp[%s %t]
With this batch file and command definition in place, we could use the following command in place of reverse in our make file:
REV test.txt reversed.txt
This command will only be required when "reversed.txt" does not exist, or when "test.txt" is newer than "reversed.txt".
Like command-definition statements, command-equivalence statements may be used to expand CMAKE's command table. A command- equivalence statement tells CMAKE that a particular command should be processed as if it were another command.
Syntax
The general form of the command-equivalence configuration statement is:
White space between 'command_equivalence' and the command name is ignored. Both the command and equivalent-command names are required. The names may be up to 8 characters long and should not include-file-name extensions such as '.bat', '.com', or '.exe'. The command names are not case sensitive. White space between the command name and equivalent-command name is ignored.
The equivalent-command name must be either an intrinsic command (e.g. CL, LINK, LIB, MASM,...), or a user-defined command that has been defined in a previous command-definition statement.
See: Equivalent Commands
Example
Suppose that for some reason you choose to use a linker called, NEWLINK, in place of LINK. If NEWLINK's command-line interface is the same as LINK, you could use the following command-equivalence statement to tell CMAKE that the NEWLINK command should be handled as if it were a LINK command:
command_equivalence : newlink = link
Using CMAKE with Your Editor
BRIEF Epsilon The Microsoft Editor
After you execute CMAKE, you should review the output of CMAKE to determine if CMAKE (or one of the commands that CMAKE has executed), has failed or generated a warning message. To perform this review, you may redirect the output of CMAKE to a log file, and load the log file into your editor. Many programmer's editors (e.g. BRIEF, Epsilon, and the Microsoft Editor) provide a mechanism to efficiently view all compiler error messages. These editors interpret the log file in order to place you at the location in a source file where an error has occurred. Using this technique, you can view all errors messages and correct the problems as you go.
CMAKE uses a standard format for its error messages. Any editor that can interpret the error messages that are generated by the program, CL, will be able to interpret the error messages that are generated by CMAKE.
Using CMAKE with BRIEF
What is BRIEF?
Running CMAKE from BRIEF
Running CMAKE from DOS and Viewing Error Messages with BRIEF
Running CMAKE in a Batch File from BRIEF
Helpful Hints
What is BRIEF?
BRIEF is a programmer's editor that is available from Solution Systems. It supports a C-like macro language and is distributed with many useful macros.
Running CMAKE from BRIEF
First, you should create an appropriate set of environment variables of the form:
BC[ext]="!CMAKE"
If you would like to able to execute CMAKE while you are editing a file that has one of the extensions: '.c', '.h', '.mak', or '.lnk'; you could create the following set of environment variables:
The character, '!', is used to indicate that we would like to see warning messages, even when CMAKE and all the commands that CMAKE executes, are successful (i.e. return zero).
Run BRIEF and edit a file with an extension for which you have created an environment variable.
To execute CMAKE, use the compile buffer command (Alt-F10).
After CMAKE is done, you will be placed at the source-file location of the first error (if there are any errors). The error message will be displayed in the message area at the bottom of the screen.
Use the next_error command (Ctrl-n) to view additional error messages.
Use the next_error 1 command (Ctrl-p) to pop up the error window. From this window, you may select any error that you would like to review.
The Error-Log File
If an error is found during compilation, BRIEF will create an error-log file. The error-log-file name will be derived from the edited-file name by replacing the extension with '.err'. For example, if you were editing a file called, "c:\h\test.h", when you initiated a compile, and there are errors, BRIEF will create an error-log file called, "c:\h\test.err".
The error-log file is a system buffer that you may not edit.
If you exit BRIEF and then restart BRIEF, you may edit the error- log file and use the next_error and next_error 1 commands to view the errors from the earlier session.
If no errors are found, BRIEF will not create an error-log file.
Running CMAKE from DOS and Viewing Error Messages with BRIEF
Create a batch file with the following commands:
CMAKE >log.err B log.err -mnext_error
Run the batch file from DOS.
If there are any errors, you will be placed at the source-file location of the first error. The error message will be displayed in the message area at the bottom of the screen.
Use the next_error command (Ctrl-n) to view additional error messages.
Use the next_error 1 command (Ctrl-p) to pop up the error window. From this window, you may select any error that you would like to review.
Running CMAKE in a Batch File from BRIEF
Create a batch file, "run.bat", of the form:
CMAKE >log.err
Record the following keystroke macro:
F7 Remember F10 dos "run.bat" Execute Command To return from DOS Alt-e "log.err" edit_file Ctrl-p next_error 1 Enter enter F10 Remember
This macro will execute the batch file, "run.bat", and load the log file, "log.err", into BRIEF.
You may use Alt-F8 and Alt-F7 to save and load the macro, respectively.
Use F8 to playback the macro.
Use the next_error command (Ctrl-n) to view each error message.
If the next_error command is included in the macro, you will be placed at the location of the first error (if there are any errors). However, the message area will not show the message of the first error. The message, "Playback successful", will overlay the error message.
Helpful Hints for BRIEF Users
Disk Swapping
Viewing Previous Errors
Modifying BRIEF
Viewing the Error-Log File
Disk Swapping with BRIEF
If you will be executing CMAKE from within BRIEF, you should use the flag, M, to enable disk swapping. This will provide more memory for CMAKE and the programs that CMAKE executes. This flag may be added to the BFLAGS environment variable. For example:
BFLAGS=-bi120k7l256Mru100za -mJPG -mrestore ^
Viewing Previous Errors with BRIEF
A macro consisting of the key strokes, (Ctrl-p UpArrow Enter), could be used to view the previous error.
Modifying BRIEF
The BRIEF macro file, "errorfix.cb", controls the way in which BRIEF handles the error-log file. You may change this macro to suit your needs.
For example see: Viewing the Error-Log File
Viewing the Error-Log File with BRIEF
Most of the error messages that are listed in the error-log file will be of the form:
file_name(line_number) : message
When the file name in the error message does not begin with a drive letter, '/', or '\', BRIEF prefixes the path of the error- log file to the file name. Because of this, if you use relative paths or no paths (vs. absolute paths) on your file names, you will have to place the error-log file in the directory from which you execute CMAKE. If you would prefer to place the error file into another directory, make the following changes to the routine, "_error_info", in the BRIEF macro file, "errorfix.cb":
1. Replace string error_text; With string error_text, curdir_string;
With this change in place, when the file name in the error message does not begin with a drive letter, '/', or '\', BRIEF will prefix the current directory to the file name.
Using CMAKE with Epsilon
What is Epsilon?
Running CMAKE from Epsilon
Running CMAKE from DOS and Viewing Error Messages with Epsilon
Running CMAKE in a Batch File from Epsilon
Helpful Hints
What is Epsilon?
Epsilon is a powerful programmer's editor that is available from Lugaru Software, Ltd.
Running CMAKE from Epsilon
Execute CMAKE with the make command:
(C-U) (C-X m) CMAKE
After CMAKE is done, you will be placed at the source-file location of the first error message (if there are any errors). The error message will be displayed on the dialog line at the bottom of the screen.
Use next_error (C-X C-N) to view additional error messages.
To execute CMAKE again, use the make command (C-X m) (without any arguments).
To establish CMAKE as your default make command for future Epsilon sessions, use the write_state command (C-F-3). If you do this, the next time you execute Epsilon, you will be able to use the make command (C-X m) (without any arguments) to invoke CMAKE.
Running CMAKE from DOS and Viewing Error Messages with Epsilon
If there are any errors, you will be placed at the source-file location of the first error. The error message will be displayed on the dialog line at the bottom of the screen.
Use next_error (C-X C-N) to view additional error messages.
Running CMAKE in a Batch File from Epsilon
Create a batch file, "run.bat", of the form:
CMAKE
Execute the batch file, "run.bat", with the following make command:
(C-U) (C-X m) run.bat
After "run.bat" is done, you will be placed at the source-file location of the first error (if there are any errors). The error message will be displayed on the dialog line at the bottom of the screen.
Use next_error (C-X C-N) to view additional error messages.
To execute CMAKE again, use the make command (C-X m) (without any arguments).
To establish "run.bat" as your default make command for future Epsilon sessions, use the write_state command (C-F-3). If you do this, the next time you execute Epsilon, you will be able to use the make command (C-X m) (without any arguments) to invoke "run.bat".
Helpful Hints for Epsilon Users
Increasing Speed
Viewing Previous Errors
Clearing the Process Buffer
Viewing the Error-Log File
Increasing Speed with Epsilon
If you will be executing CMAKE from within Epsilon, you should use the -fs option to instruct Epsilon to use a RAM drive path for swap files. This flag may be added to the EPSILON environment variable. For example:
SET EPSILON=-fsd:\temp
Viewing Previous Errors with Epsilon
To view the previous error quickly, you may record the following macro:
This macro should be recorded after you have invoked CMAKE with the make command, and generated some errors.
Clearing the Epsilon Process Buffer
The variable, clear_process_buffer, is 0 by default. To purge the process buffer before each make call, set this variable to a nonzero value. You may do this with the following commands:
If you do not set the variable, clear_process_buffer, to a nonzero value, all error messages from all make calls will accumulate in your error log.
Viewing the Error-Log File with Epsilon
Most of the error messages that are listed in the error-log file will be of the form:
file_name(line_number) : message
When the file name in the error message does not begin with a drive letter, '/', or '\', Epsilon prefixes the current directory to the file name. Because of this, if you use relative paths or no paths (vs. absolute paths) on your file names, you should view the error-log file from the directory from which you executed CMAKE.
Using CMAKE with The Microsoft Editor
What is the Microsoft Editor?
The TMP Environment Variable
Running CMAKE from the Microsoft Editor
Running CMAKE from DOS and Viewing Errors with the Microsoft Editor
Running CMAKE in a Batch File from the Microsoft Editor
Helpful Hints
What is the Microsoft Editor?
The Microsoft Editor is a programmer's editor that was distributed with the Microsoft C Optimizing Compiler Version 5.1 and the Microsoft Macro Assembler Version 5.1. It consists of a single executable, M.EXE (and a supporting initialization file called, "tools.ini"). The Microsoft Editor is a powerful (and fast) tool that supports macros and extensions which may be coded in C.
The TMP Environment Variable for the Microsoft Editor
You should set the environment variable, TMP, to establish the location of the error-log file "m.msg". (The error-log file used by the Microsoft Editor is always called, "m.msg".)
Running CMAKE from the Microsoft Editor
First, you should add an appropriate set of commands of the form:
extmake:[ext] CMAKE
to the file, "tools.ini". If you would like to able to execute CMAKE while you are editing a file that has one of the extensions: '.c', '.h', '.mak', '.lnk', or '.msg'; you could use the following set of commands in the your "tools.ini" file:
Run the Microsoft Editor and edit a file with an extension for which you have added an "extmake" command to your "tools.ini" file.
To execute CMAKE, use Arg Compile (Alt+A Shift+F3) or Argcompile (F5).
After CMAKE is done, you will be placed at the source-file location of the first error (if there are any errors). The error message will be displayed on the dialog line at the bottom of the screen.
Use Compile (Shift+F3) to view additional error messages.
Running CMAKE from DOS and Viewing Errors with the Microsoft Editor
Create a batch file with the following commands:
CMAKE >%TMP%\m.msg M %TMP%\m.msg
Run the batch file from DOS.
Use Compile (Shift+F3) (repeatedly) to view each error message.
Note that if "/e compile" is added to the Microsoft Editor command line, you will be placed at the location of the first error (if there are any errors), but the error message will not appear on the dialog line. The Microsoft copyright message will overlay the error message.
Running CMAKE in a Batch File from the Microsoft Editor
Create a batch file, "run.bat", with the following commands:
CMAKE >m.msg
Define the following macro in your "tools.ini" file:
This macro will execute the batch file, "run.bat", and load the log file, "m.msg", into the Microsoft Editor.
Use Alt+R to playback the macro.
Use Compile (Shift+F3) (repeatedly) to view each error message.
You may use the following alternative macro, if you would like to avoid having to manually execute the first Compile command after executing the macro:
where "dummy" is a file that does not exist. (Remember that when you add this macro to the file, "tools.ini", the entire macro definition must be specified on one line.) If this macro is used, you will be placed at the location of the first error (if there are any errors). The sequence, Arg Arg "dummy" Compile, is used to reset the Microsoft Editor error message pointer to the "bottom" of the list, so that the final Compile in the "run" macro will bring us to the "top" of the error list.
Helpful Hints for Users of the Microsoft Editor
Increasing Speed
A Macro to Select the Error-Log File
Viewing the Error-Log File
Increasing Speed with the Microsoft Editor
To increase speed, set the TMP environment variable to a path on a RAM drive.
A Macro to Select the Error-Log File with the Microsoft Editor
The following macro may be used to select the error-log file, "m.msg":
Viewing the Error-Log File with the Microsoft Editor
Most of the error messages that are listed in the error-log file will be of the form:
file_name(line_number) : message
When the file name in the error message does not begin with a drive letter, '/', or '\', the Microsoft Editor prefixes the current directory to the file name. Because of this, if you use relative paths or no paths (vs. absolute paths) on your file names, you should view the error-log file from the directory from which you executed CMAKE.
Optimizing Performance
Overview
Use the End-of-Includes Comment in Your Source Files
Help CMAKE Find Include Files Quickly
Have CMAKE Put "makefile.bat" on a RAM Drive
Avoid Using the Verbose Output Format for CMAKE
Redirect CMAKE Output to a File on a RAM Drive
Do Not Have CMAKE Scan Include Files for Includes Unnecessarily
Do Not Have CMAKE Check System-Include Dependencies Unnecessarily
Help CMAKE Find Configuration Data Quickly
Overview of Optimization Techniques for CMAKE
There are a number of techniques that may be used to increase the speed of CMAKE. Most of these techniques involve setting switches to ensure that CMAKE does not do more work than is necessary.
The execution time that is provided by CMAKE may be used to help you determine how to achieve the best performance in a given situation.
Use the End-of-Includes Comment in Your Source Files
Place all include statements at the top of your source files. The following comments should be placed within each source file, after the section that contains the include statements:
File Types Comment
.c .h .rc /* CMAKE - INCLUDE END */ .asm ; CMAKE - INCLUDE END
CMAKE stops processing a given source file when an appropriate "end-of-includes" comment is reached. Note that for resource- script files ('.rc'), the comment should be placed after all include statements and resource-include statements (i.e. ICON, BITMAP, CURSOR, FONT, or user-defined resource statements).
For many applications, if these comments are used, the execution time for CMAKE will be reduced by 50%.
Help CMAKE Find Include Files Quickly
If all of your application's source files and include files are located in the directory from which you execute CMAKE, the include files will be found quickly.
On the other hand, if you use the INCLUDE environment variable to specify the location of your application's include files, there will be a danger that CMAKE will waste time by first looking in the wrong directories too often before finally locating each include file.
If you do not keep your include files in the source directory or current directory, add the following statements to your configuration file to insure that CMAKE will not search these directories for include files:
search_current_dir_for_includes = no search_source_dir_for_includes = no
For many applications, if you eliminate unnecessary searches of the source directory and current directory, the execution time for CMAKE will be reduced by 15%.
You could also place all of your include files in a single directory, and list this directory first in your INCLUDE environment variable. For many applications, if this technique is used, the execution time for CMAKE will be reduced by 50%.
If you do not wish to place all of your application's include files into a single directory, you should arrange the directories in you INCLUDE environment variable so that the directories that contain most of your application's include files are listed first. Depending upon your situation, you might be able to save even more time by adding "set INCLUDE" statements to your make file in order to rearrange the directories "on the fly" in a way that is optimal for each module.
Have CMAKE Put "makefile.bat" on a RAM Drive
After analyzing your make file, CMAKE creates and executes the batch program, "makefile.bat". You might wish to use the CMAKE command-line option, /o, to instruct CMAKE to place the file, "makefile.bat", on a RAM drive path. For example, if "d:\temp" is a path on a RAM drive, you could execute CMAKE with the following command:
CMAKE /od:\temp
Alternatively, if the environment variable, TEMP, is set to "d:\temp", you could use the following command in a batch file to execute CMAKE:
CMAKE /o%TEMP%
(In these examples, we have assumed that the make file is located in the current directory and is called, "makefile").
Avoid Using the Verbose Output Format for CMAKE
The verbose output format (which is enabled with the /v option) is a useful debugging tool. However, since it is quite detailed, the execution time for CMAKE might double when the verbose output format is selected.
Redirect CMAKE Output to a File on a RAM Drive
If you will be redirecting the output from CMAKE to a file, place that file on a RAM drive. For example, if "d:\temp" is a path on a RAM drive, you could execute CMAKE with the following command:
CMAKE >d:\temp\cmake.log
Alternatively, if the environment variable, TEMP, is set to "d:\temp", you could use the following command in a batch file to execute CMAKE:
CMAKE >%TEMP%\cmake.log
(In these examples, we have assumed that the make file is located in the current directory and is called, "makefile".)
Do Not Have CMAKE Scan Include Files for Includes Unnecessarily
By default, CMAKE does not scan include files for include statements. This default behavior may be altered by adding the following statement to your configuration file:
scan_include_files_for_includes = yes
If you enable this switch, the execution time for CMAKE could quadruple! You could reduce the impact of enabling this switch by using "end-of-includes" comments within your include files, or, if the use of include statements within include files is limited to only a few files, you could enable this switch as needed, by using the following statements in your make file:
REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES ON REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES OFF
Do Not Have CMAKE Check System-Include Dependencies Unnecessarily
By default, CMAKE ignores system-include statements. If you modify system-include files, you will not want CMAKE to ignore these statements (at least not all of them). To instruct CMAKE to check system-include file dependencies, you could add the following statements to your configuration file:
c_include_<>_on = yes rc_include_<>_on = yes
If you enable these switches, the execution time for CMAKE could double. A more efficient approach would be to use the following comments in your source files, as needed:
File Types Comment
.c .h .rc /* CMAKE - INCLUDE <> ON/OFF */
Help CMAKE Find Configuration Data Quickly
If you place the configuration data for CMAKE at the end of a long file that is shared by other applications (e.g. "win.ini"), CMAKE will have to scan the entire file until it reaches the section tag, [CMAKE]. This could add a few seconds to the execution time for CMAKE. To eliminate the time it takes CMAKE to locate its configuration data, put the data at the top of a shared file, or in its own file (e.g. "cmake.cfg").
CMAKE Exit Codes
If an error occurs before the batch program, "makefile.bat", is executed, CMAKE will terminate and return one of the following exit codes:
EXIT CODE MEANING
0 Success 9659 CMAKE Command-Line Error 9660 Unable to Load Configuration Data 9661 Make File Not Found 9662 Unable to Create "makefile.bat" 9663 Unable to Create Predefined Pseudofile "start.psf" 9664 Unable to Process some Make-File Command or Statement 9665 A Token in the Make File was Truncated 9666 Nested Comments were Found in the Make File 9667 Out of Memory 9668 Unable to Flush Standard-Output-File Buffer 9669 Unable to Run "makefile.bat" 9670 Unable to Run QH.EXE
If the batch program, "makefile.bat", is executed and one of the commands in "makefile.bat" fails (i.e. returns a nonzero value), CMAKE will return the value that was returned by the command that failed.
Technical Support for CMAKE
You may contact the author of CMAKE (John Greschak) at
This sample demonstrates how to use CMAKE to maintain a DOS application that is built with the programs: CL, LIB, and LINK.
Note the Following:
1. The commands (and comments) in the make file. CMAKE will deduce all dependencies from these commands.
See: When is a CL Command Required? When is a LIB Command Required? When is a LINK Command Required?
2. The format of the LIB response file, "message.lrf". CMAKE requires that a response file (of a particular form) be used with the LIB command.
See: The LIB Command Line
3. The format of the LINK response file, "greeting.lnk". CMAKE requires that a response file (of a particular form) be used with the LINK command.
See: The LINK Command Line
4. The use and placement of the comment
/* CMAKE - INCLUDE END */
in the files, "hello.c", "world.c", and "greeting.c".
In these files, this comment is placed after all #include statements. Although this comment is not required in C-source files, it serves as an end-of-file mark for CMAKE, and thus prevents CMAKE from searching the entire source file for #include statements.
See: Use the End-of-Includes Comment in Your Source Files Switches for CL How CMAKE Processes a C-Source File
/***************************************************************** * MAKEFILE * * PURPOSE: Build the following modules: * * "hello.obj" "message.lib" "greeting.exe" * "world.obj" "greeting.obj" * * NOTE: None of the comments in this make file are required. * They have been provided to help you understand how CMAKE * handles each command. In other words, this make file * could be reduced down to the following five commands: * * cl /c /W4 hello.c * cl /c /W4 world.c * lib @message.lrf * cl /c /W4 greeting.c * link @greeting.lnk * *****************************************************************/
/***************************************************************** * HELLO.OBJ * * The following CL command will be executed only when one of the * following conditions is true: * * 1. "hello.obj" does not exist. * 2. "hello.c" is newer than "hello.obj". * 3. "hello.h" is newer than "hello.obj". * *****************************************************************/
cl /c /W4 hello.c
/***************************************************************** * WORLD.OBJ * * The following CL command will be executed only when one of the * following conditions is true: * * 1. "world.obj" does not exist. * 2. "world.c" is newer than "world.obj". * 3. "world.h" is newer than "world.obj". * *****************************************************************/
cl /c /W4 world.c
/***************************************************************** * MESSAGE.LIB * * The following LIB command will be executed only when one of the * following conditions is true: * * 1. "message.lib" does not exist. * 2. "hello.obj" is newer than "message.lib". * 3. "world.obj" is newer than "message.lib". * * Actually, only those objects that are newer than the library, * "message.lib", will be added to the library. For example,
* suppose "message.lib" exists, "hello.obj" is newer than * "message.lib", and "world.obj" is older than "message.lib". * In this case, only "hello.obj" must be added to the library, * "message.lib". Thus, in this case, CMAKE would execute the * following command: * * lib @message.clb * * where "message.clb" consists of the following lines: * * message.lib * -+hello.obj ; * *****************************************************************/
lib @message.lrf
/***************************************************************** * GREETING.OBJ * * The following CL command will be executed only when one of the * following conditions is true: * * 1. "greeting.obj" does not exist. * 2. "greeting.c" is newer than "greeting.obj". * 3. "hello.h" is newer than "greeting.obj". * 4. "world.h" is newer than "greeting.obj". * 5. "greeting.h" is newer than "greeting.obj". * *****************************************************************/
cl /c /W4 greeting.c
/***************************************************************** * GREETING.EXE * * The following LINK command will be executed only when one of * the following conditions is true: * * 1. "greeting.exe" does not exist. * 2. "greeting.obj" is newer than "greeting.exe". * 3. "message.lib" is newer than "greeting.exe". * *****************************************************************/
This sample demonstrates how to use CMAKE to maintain a Microsoft Windows application that is built with the programs: CL, RC, and LINK.
Note the Following:
1. The commands (and comments) in the make file. CMAKE will deduce all dependencies from these commands.
See: When is a CL Command Required? When is an RC/C Command Required? When is an RC/A Command Required? When is a LINK Command Required?
2. The format of the LINK response file, "hw.lnk". CMAKE requires that a response file (of a particular form) be used with the LINK command.
See: The LINK Command Line
Since CMAKE does not use the LIB environment variable, the paths of the Windows libraries, "libw.lib" and "slibcew.lib" must be provided.
3. The use and placement of the comment
/* CMAKE - INCLUDE END */
in the files, "hw.c" and "hw.rc".
In the file, "hw.c", this comment is placed after all #include statements. Although this comment is not required in C-source files, it serves as an end-of-file mark for CMAKE, and thus prevents CMAKE from searching the entire source file for #include statements.
See: Use the End-of-Includes Comment in Your Source Files Switches for CL How CMAKE Processes a C-Source File
In the file, "hw.rc", this comment is placed after all #include
statements and resource-include statements (i.e. ICON, BITMAP, CURSOR, FONT, or user-defined resource statements). This comment is required in this file.
See: Helpful Hints for RC/C Switches for RC/C How CMAKE Processes a Resource-Script File Use the End-of-Includes Comment in Your Source Files
/***************************************************************** * MAKEFILE * * PURPOSE: Build the following modules: * * "hw.res" "hw.exe" * "hw.obj" * * NOTE: None of the comments in this make file are required. * They have been provided to help you understand how CMAKE * handles each command. In other words, this make file * could be reduced down to the following four commands: * * rc /r hw.rc * cl /c /AS /Gsw /Oas /Zpe hw.c * link @hw.lnk * rc hw.res * *****************************************************************/
/***************************************************************** * HW.RES * * The following RC compile command will be executed only when one * of the following conditions is true: * * 1. "hw.res" does not exist. * 2. "hw.rc" is newer than "hw.res". * 3. "hw.h" is newer than "hw.res". * 4. "hw.ico" is newer than "hw.res". * 5. "hw.dlg" is newer than "hw.res". * *****************************************************************/
rc /r hw.rc
/***************************************************************** * HW.OBJ * * The following CL command will be executed only when one of the * following conditions is true: * * 1. "hw.obj" does not exist. * 2. "hw.c" is newer than "hw.obj". * 3. "hw.h" is newer than "hw.obj". * *****************************************************************/
cl /c /AS /Gsw /Oas /Zpe hw.c
/***************************************************************** * HW.EXE * * The following LINK command will be executed only when one of * the following conditions is true: * * 1. "hw.exe" does not exist. * 2. "hw.obj" is newer than "hw.exe". * 3. "c:\windev\lib\libw.lib" is newer than "hw.exe". * 4. "c:\windev\lib\slibcew.lib" is newer than "hw.exe". * 5. "hw.def" is newer than "hw.exe". * *****************************************************************/
link @hw.lnk
/***************************************************************** * ADD HW.RES TO HW.EXE * * The following RC command (used to add the resource file, * "hw.res", to the executable file, "hw.exe") will be executed * only when one of the following conditions is true: * * 1. The previous RC command used to build, "hw.res", was * executed. * 2. The previous LINK command used to build, "hw.exe", was * executed. * *****************************************************************/
This sample demonstrates how to use CMAKE to maintain a DOS application that is built with the programs: MASM, CL, LIB, and LINK.
Note the Following:
1. The commands (and comments) in the make file. CMAKE will deduce all dependencies from these commands.
See: When is a MASM Command Required? When is a CL Command Required? When is a LIB Command Required? When is a LINK Command Required?
2. The format of the LIB response file, "message.lrf". CMAKE requires that a response file (of a particular form) be used with the LIB command.
See: The LIB Command Line
3. The format of the LINK response file, "greeting.lnk". CMAKE requires that a response file (of a particular form) be used with the LINK command.
See: The LINK Command Line
4. The use and placement of the comment
; CMAKE - INCLUDE END
in the files, "a_hello.asm" and "a_world.asm".
In these files, this comment is placed after all include statements. Although this comment is not required in assembly- language-source files, it serves as an end-of-file mark for CMAKE, and thus prevents CMAKE from searching the entire source file for include statements.
See: Use the End-of-Includes Comment in Your Source Files Switches for MASM How CMAKE Processes an Assembly-Language-Source File
5. The use and placement of the comment
/* CMAKE - INCLUDE END */
in the files, "hello.c", "world.c", and "greeting.c".
In these files, this comment is placed after all #include statements. Although this comment is not required in C-source files, it serves as an end-of-file mark for CMAKE, and thus prevents CMAKE from searching the entire source file for #include statements.
See: Use the End-of-Includes Comment in Your Source Files Switches for CL How CMAKE Processes a C-Source File
/***************************************************************** * MAKEFILE * * PURPOSE: Build the following modules: * * "a_hello.obj" "hello.obj" "message.lib" "greeting.exe" * "a_world.obj" "world.obj" "greeting.obj" * * NOTE: None of the comments in this make file are required. * They have been provided to help you understand how CMAKE * handles each command. In other words, this make file * could be reduced down to the following seven commands: * * masm /W2 /V /Z a_hello.asm,a_hello.obj; * masm /W2 /V /Z a_world.asm,a_world.obj; * cl /c /W4 hello.c * cl /c /W4 world.c * lib @message.lrf * cl /c /W4 greeting.c * link @greeting.lnk * *****************************************************************/
/***************************************************************** * A_HELLO.OBJ * * The following MASM command will be executed only when one of * the following conditions is true: * * 1. "a_hello.obj" does not exist. * 2. "a_hello.asm" is newer than "a_hello.obj". * 3. "hello.inc" is newer than "a_hello.obj". * *****************************************************************/
masm /W2 /V /Z a_hello.asm,a_hello.obj;
/***************************************************************** * A_WORLD.OBJ * * The following MASM command will be executed only when one of * the following conditions is true: * * 1. "a_world.obj" does not exist. * 2. "a_world.asm" is newer than "a_world.obj". * 3. "world.inc" is newer than "a_world.obj". * *****************************************************************/
masm /W2 /V /Z a_world.asm,a_world.obj;
/***************************************************************** * HELLO.OBJ * * The following CL command will be executed only when one of the * following conditions is true: * * 1. "hello.obj" does not exist. * 2. "hello.c" is newer than "hello.obj". * 3. "hello.h" is newer than "hello.obj". * *****************************************************************/
cl /c /W4 hello.c
/***************************************************************** * WORLD.OBJ * * The following CL command will be executed only when one of the * following conditions is true: * * 1. "world.obj" does not exist. * 2. "world.c" is newer than "world.obj". * 3. "world.h" is newer than "world.obj". * *****************************************************************/
cl /c /W4 world.c
/***************************************************************** * MESSAGE.LIB * * The following LIB command will be executed only when one of the * following conditions is true: * * 1. "message.lib" does not exist. * 2. "a_hello.obj" is newer than "message.lib". * 3. "a_world.obj" is newer than "message.lib". * 4. "hello.obj" is newer than "message.lib". * 5. "world.obj" is newer than "message.lib". * * Actually, only those objects that are newer than the library, * "message.lib", will be added to the library. For example, * suppose "message.lib" exists, "a_hello.obj" is newer than * "message.lib", and "message.lib" is newer than "a_world.obj", * "hello.obj", and "world.obj". In this case, only "a_hello.obj" * must be added to the library, "message.lib". Thus, in this * case, CMAKE would execute the following command: * * lib @message.clb * * where "message.clb" consists of the following lines: * * message.lib * -+a_hello.obj ; * *****************************************************************/
lib @message.lrf
/***************************************************************** * GREETING.OBJ * * The following CL command will be executed only when one of the * following conditions is true: * * 1. "greeting.obj" does not exist. * 2. "greeting.c" is newer than "greeting.obj". * 3. "a_hello.h" is newer than "greeting.obj". * 4. "a_world.h" is newer than "greeting.obj". * 5. "greeting.h" is newer than "greeting.obj". * *****************************************************************/
cl /c /W4 greeting.c
/***************************************************************** * GREETING.EXE * * The following LINK command will be executed only when one of * the following conditions is true: * * 1. "greeting.exe" does not exist. * 2. "greeting.obj" is newer than "greeting.exe". * 3. "message.lib" is newer than "greeting.exe". * *****************************************************************/
/***************************************************************** * MAKEFILE * * PURPOSE: Copy some files. * * NOTE: None of the comments in this make file are required. * They have been provided to help you understand how CMAKE * handles each command. In other words, this make file * could be reduced down to the following four commands: * * copy src\1.src trg\1.trg * copy src\more\3.src trg * copy src trg\12.trg * copy src trg * *****************************************************************/
/***************************************************************** * COPY FILE TO FILE * * The following COPY command will be executed only when one of * the following conditions is true: * * 1. "trg\1.trg" does not exist. * 2. "src\1.src" is newer than "trg\1.trg". * *****************************************************************/
copy src\1.src trg\1.trg
/***************************************************************** * COPY FILE TO DIRECTORY * * The following COPY command will be executed only when one of * the following conditions is true: * * 1. "trg\3.src" does not exist. * 2. "src\more\3.src" is newer than "trg\3.src". * *****************************************************************/
copy src\more\3.src trg
/***************************************************************** * COPY DIRECTORY TO FILE * * The following COPY command will always be executed. * *****************************************************************/
copy src trg\12.trg
/***************************************************************** * COPY DIRECTORY TO DIRECTORY * * The COPY command: * * copy src\1.src trg\1.src * * will be executed only when one of the following conditions is * true: * * 1. "trg\1.src" does not exist. * 2. "src\1.src" is newer than "trg\1.src". * * The COPY command: * * copy src\2.src trg\2.src * * will be executed only when one of the following conditions is * true: * * 1. "trg\2.src" does not exist. * 2. "src\2.src" is newer than "trg\2.src". * *****************************************************************/
/***************************************************************** * MAKEFILE * * PURPOSE: Build the following modules: * * "hello.obj" "message.lib" "greeting.exe" * "world.obj" "greeting.obj" * * NOTE: Since CMAKE automatically determines the dependencies * for CL, LIB, and LINK, you would not ordinarily use an * if statement to explicitly specify dependencies for these * commands. The if statement has been used in this make * file for demonstration purposes, only. * * None of the comments in this make file are required. * They have been provided to help you understand how CMAKE * handles each command. * *****************************************************************/
/***************************************************************** * HELLO.OBJ * * The following CL and LIB commands will be executed only when * one of the following conditions is true: * * 1. "hello.obj" does not exist. * 2. "message.lib" does not exist. * 3. "hello.c" is newer than "hello.obj". * 5. "hello.c" is newer than "message.lib". * 4. "hello.h" is newer than "hello.obj". * 6. "hello.h" is newer than "message.lib". * *****************************************************************/
if ( hello.obj message.lib < hello.c hello.h )
{ cl /c /W4 hello.c
lib message.lib -+hello.obj; }
/***************************************************************** * WORLD.OBJ * * The following CL and LIB commands will be executed only when * one of the following conditions is true: * * 1. "world.obj" does not exist. * 2. "message.lib" does not exist. * 3. "world.c" is newer than "world.obj". * 5. "world.c" is newer than "message.lib". * 4. "world.h" is newer than "world.obj". * 6. "world.h" is newer than "message.lib". * *****************************************************************/
if ( world.obj message.lib < world.c world.h )
{ cl /c /W4 world.c
lib message.lib -+world.obj; }
/***************************************************************** * GREETING.OBJ * * The following CL command will be executed only when one of the * following conditions is true: * * 1. "greeting.obj" does not exist. * 2. "greeting.c" is newer than "greeting.obj". * 3. "hello.h" is newer than "greeting.obj". * 4. "world.h" is newer than "greeting.obj". * 5. "greeting.h" is newer than "greeting.obj". * *****************************************************************/
if ( greeting.obj < greeting.c hello.h world.h greeting.h )
cl /c /W4 greeting.c
/***************************************************************** * GREETING.EXE * * The following LINK command will be executed only when one of * the following conditions is true: * * 1. "greeting.exe" does not exist. * 2. "greeting.obj" is newer than "greeting.exe". * 3. "message.lib" is newer than "greeting.exe". * *****************************************************************/
This sample demonstrates how to add a new command to CMAKE's vocabulary through the use of a command-definition statement in the configuration file, "cmake.cfg".
Note the Following:
1. The commands (and comments) in the make file. CMAKE will deduce all dependencies from these commands.
See: When is a User-Defined Command Required?
2. The command-definition statement and section tag, [CMAKE], in the configuration file, "cmake.cfg".
See: Command-Definition Statements The CMAKE Section Tag in the Configuration File
/***************************************************************** * MAKEFILE * * PURPOSE: Concatenate the text files, "source1.txt" and * "source2.txt", and sort the resulting file, * "target.txt". * * NOTE: None of the comments in this make file are required. * They have been provided to help you understand how CMAKE * handles each command. In other words, this make file * could be reduced down to the following command: * * sortsum source1.txt source2.txt target.txt * *****************************************************************/
/***************************************************************** * TARGET.TXT * * The following SORTSUM command will be executed only when one of * the following conditions is true: * * 1. "target.txt" does not exist. * 2. "source1.txt" is newer than "target.txt". * 3. "source2.txt" is newer than "target.txt". * *****************************************************************/
This sample demonstrates how to add a new command to CMAKE's vocabulary through the use of a command-equivalence statement in the configuration file, "cmake.cfg".
Note the Following:
1. The commands (and comments) in the make file. CMAKE will deduce all dependencies from these commands.
See: When is a User-Defined Command Required? How CMAKE Processes an Equivalent Command
2. The command-equivalence statement, command-definition statement, and section tag, [CMAKE], in the configuration file, "cmake.cfg".
See: Command-Equivalence Statements Command-Definition Statements The CMAKE Section Tag in the Configuration File
Command-Equivalence Statement Sample
readme.txt cmake.cfg makefile 1.txt
/***************************************************************** * MAKEFILE * * PURPOSE: Create the file, "2.txt", by sorting the file, * "1.txt". Create the file, "3.txt", by extracting all * the lines from the file, "2.txt", that contain the * word "toad". * * NOTE: None of the comments in this make file are required. * They have been provided to help you understand how CMAKE * handles each command. In other words, this make file * could be reduced down to the following two commands: * * sort <1.txt >2.txt * find "toad" <2.txt >3.txt * *****************************************************************/
/***************************************************************** * 2.TXT * * The following SORT command will be executed only when one of * the following conditions is true: * * 1. "2.txt" does not exist. * 2. "1.txt" is newer than "2.txt". * *****************************************************************/
sort <1.txt >2.txt
/***************************************************************** * 3.TXT * * The following FIND command will be executed only when one of * the following conditions is true: * * 1. "3.txt" does not exist. * 2. "2.txt" is newer than "3.txt". * *****************************************************************/
The toad. The hungry toad. The flea. The edible flea. The hungry toad chased the edible flea.
Configuration File Sample
readme.txt cmake.cfg
This sample demonstrates all the possible types of statements that may be used in a CMAKE configuration file.
Note the Following in the File, "cmake.cfg":
1. The comments.
See: Comments in the Configuration File
2. The section tag, [CMAKE].
See: The CMAKE Section Tag in the Configuration File
3. The assignment statements. "cmake.cfg" gives a complete list of the Boolean variables that may be used in a configuration file. In this sample, each Boolean variable is set to its default value.
See: Assignment Statements in the Configuration File
4. The command-definition statement.
See: Command-Definition Statements
5. The command-equivalence statement.
See: Command-Equivalence Statements
Configuration File Sample
readme.txt cmake.cfg
; cmake.cfg - CMAKE configuration file
[CMAKE]
; Assignment statements scan_include_files_for_includes = no search_source_dir_for_includes = yes search_current_dir_for_includes = yes c_include_""_on = yes c_include_<>_on = no asm_include_on = yes rc_include_""_on = yes rc_include_<>_on = no rc_include_resource_on = yes run_output_file = yes display_output_file_commands = no display_execution_time = yes
To find out about a specific error, do one of the following:
1. Click on the error number below with the right mouse button. 2. Enter S to search for an error code. 3. Execute QuickHelp with the command, QH error_number.
The command line used to invoke CMAKE was invalid.
This message is displayed only when the verbose output format is selected.
See: The CMAKE Command Line
Fatal CMAKE error M0002
CMAKE aborted
The command line used to invoke CMAKE was invalid.
This message is displayed only when the verbose output format is selected.
See: The CMAKE Command Line
Fatal CMAKE error M0003
unable to load configuration data
There is an invalid statement in the CMAKE configuration file.
This message is displayed only when the verbose output format is selected.
See: The CMAKE Configuration File
Fatal CMAKE error M0004
make file 'filename' not found
CMAKE could not find the given make file.
See: The CMAKE Command Line
Fatal CMAKE error M0007
cannot process command
One of the commands or statements in the make file could not be processed.
This message is displayed only when the verbose output format is selected.
See: The Make File
Fatal CMAKE error M0008
CMAKE aborted
This message is displayed only when the verbose output format is selected and one of the following errors has occurred: M0003, M0004, M0005, M0007, or M0104.
Fatal CMAKE error M0011
CMAKE aborted
This message is displayed only when the verbose output format is selected and one of the following errors has occurred: M0009 or M0010.
Fatal CMAKE error M0012
'character' is an invalid command-line option
An invalid option was specified in the command line used to invoke CMAKE.
See: The CMAKE Command Line
Fatal CMAKE error M0071
cannot process configuration statement
One of the statements in the configuration file could not be processed.
This message is displayed only when the verbose output format is selected.
See: The CMAKE Configuration File
Fatal CMAKE error M0126
unable to run QH.EXE - must be in current directory or PATH
The /h or /help option was specified in the command line used to invoke CMAKE. However, CMAKE could not locate the QuickHelp program, QH.EXE. QH.EXE must be in the current directory or in one of the directories specified in the PATH environment variable.
See: Display Help on CMAKE
CMAKE error M0005
output file 'filename' not created
CMAKE could not create the file, "makefile.bat".
If the /o option has been specified in the command line used to invoke CMAKE, check to be sure that the path given with this option is valid.
See: The CMAKE Command Line
CMAKE error M0009
unable to flush standard output prior to loading 'file1' to run 'file2'
CMAKE was unable to flush the standard output buffer before loading "command.com" to execute the batch program, "makefile.bat".
If you have chosen to redirect the output from CMAKE to a file, it is possible that the drive on which you have placed this file has no more free space. This is more likely in the case where your make file and/or configuration file are large, and you have selected the verbose output format and redirected the output from CMAKE to a RAM drive.
See: Select Verbose Diagnostic Output from CMAKE Avoid Using the Verbose Output Format for CMAKE Redirect CMAKE Output to a File on a RAM Drive
CMAKE error M0010
unable to load 'file1' to run output file 'file2'
CMAKE could not load "command.com" to execute the batch program, "makefile.bat". CMAKE uses the COMSPEC environment variable to locate "command.com".
If you cannot solve this problem, use the CMAKE command-line option, /n, or the configuration variable, run_output_file, to avoid executing "makefile.bat" from within CMAKE. Then, after CMAKE creates "makefile.bat", you may execute this batch file from the command line.
See: Suppress Command Execution by CMAKE run_output_file
CMAKE error M0013
source-file name is null
The source-file name for a CL command given in the make file is NULL.
See: The CL Command Line
CMAKE error M0014
object-file name is null
The object-file name for a CL command given in the make file is NULL.
See: The CL Command Line
CMAKE error M0015
unable to open source file 'filename'
CMAKE could not open the source file for a CL command given in the make file. CMAKE opens source files in order to search for #include statements.
See: The CL Command Line
CMAKE error M0016
unable to get time stamp for source file 'filename'
CMAKE could not obtain the time stamp for the source file of a CL command given in the make file.
See: The CL Command Line
CMAKE error M0017
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing a CL command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0018
include file 'filename' not found... in source directory 'sourcedirectoryname' ... or INCLUDE environment variable paths... 'includepaths'
CMAKE could not find an include file while processing a CL command given in the make file. In this case, the include-file name was appended to the source-file's directory and to the directories specified in the INCLUDE environment variable.
See: How CMAKE Processes a C-Source File
CMAKE error M0019
include file 'filename' not found... in INCLUDE environment variable paths... 'includepaths'
CMAKE could not find an include file while processing a CL command given in the make file. In this case, the include-file name was appended to the directories specified in the INCLUDE environment variable.
If your include file is located in the source-file's directory, you should check to be sure that you have not set the configuration variable, search_source_dir_for_includes, to 'no' in your configuration file.
See: search_source_dir_for_includes Switches for CL How CMAKE Processes a C-Source File
CMAKE error M0020
not enough memory to store include-file name 'filename'
CMAKE ran out of memory while processing a CL command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0021
include level exceeds 9
Too many levels of nested include statements were used in the source file of a CL command given in the make file. (The source file itself is level 0, a file that is included in the source file is level 1, etc.)
This usually indicates the presence of circular include statements.
CMAKE error M0022
unable to open include file 'filename'
CMAKE could not open an include file for a CL command given in the make file. When the configuration variable, scan_include_files_for_includes, is 'yes', CMAKE opens include files in order to search for #include statements.
If your include files do not have include statements, you should not set scan_include_files_for_includes to 'yes'.
See: scan_include_files_for_includes Switches for CL How CMAKE Processes a C-Source File REM Avoid Scanning Include Files for Includes
CMAKE error M0023
cannot determine response-file name (missing '@')
The first character of the parameter string for a LIB command given in the make file is not '@'.
See: The LIB Command Line
CMAKE error M0024
response-file name is null
The response-file name for a LIB command given in the make file is NULL.
See: The LIB Command Line
CMAKE error M0025
unable to open response file 'filename'
CMAKE could not open the response file for a LIB command given in the make file.
See: The LIB Command Line
CMAKE error M0026
not enough memory to load response file 'filename'
CMAKE ran out of memory while processing a LIB command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0027
no operations given in LIB response file
There are less than three lines in the response file for a LIB command given in the make file. CMAKE requires that the first line of the LIB response file must indicate the library name, the second line must be 'y', and the third line must indicate the first operation to be performed on the given library.
See: The LIB Command Line
CMAKE error M0028
library-file name is null
The library name provided in the response file for a LIB command given in the make file is NULL.
See: The LIB Command Line
CMAKE error M0029
unrecognized LIB operation - must be '+', '-', '-+', '*', or '-*'
One of the lines in the response file for a LIB command given in the make file begins with an invalid LIB operator.
See: The LIB Command Line
CMAKE error M0030
LIB operation must be '-+'
One of the lines in the response file for a LIB command given in the make file begins with an unexpected LIB operator.
CMAKE requires that when the third line of a LIB response file does not use the add operator, '+', all the operations specified in the response file must be '-+'.
See: The LIB Command Line
CMAKE error M0031
object file 'filename' does not exist
CMAKE could not find one of the object files listed in the response file for a LIB command given in the make file.
See: The LIB Command Line
CMAKE error M0032
response-file name 'filename' is too long - cannot add '.clb' extension
CMAKE requires that when a LIB response file specifies replace operations (-+), the length of the response-file name must not exceed 62.
See: Modified Command Line for LIB
CMAKE error M0033
new response file 'filename' not created
CMAKE could not create the LIB response file for a required LIB command given in the make file.
See: Modified Command Line for LIB
CMAKE error M0034
unable to delete new response file 'filename'
CMAKE aborted and could not remove the LIB response file that it had created for a required LIB command given in the make file.
See: Modified Command Line for LIB
CMAKE error M0035
unrecognized LIB operation - must be '+', '-', '-+', '*', or '-*'
One of the lines in the response file for a LIB command given in the make file begins with an invalid LIB operator.
See: The LIB Command Line
CMAKE error M0036
LIB operation must be '+'
One of the lines in the response file for a LIB command given in the make file begins with an unexpected LIB operator.
CMAKE requires that when the third line of a LIB response file uses the add operator, '+', all the operations specified in the response file must be '+'.
See: The LIB Command Line
CMAKE error M0037
component-library file 'filename' does not exist
CMAKE could not find one of the component-library files listed in the response file for a LIB command given in the make file.
See: The LIB Command Line
CMAKE error M0038
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing a LIB command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0039
cannot determine response-file name (missing '@')
The first character of the parameter string for a LINK command given in the make file is not '@'.
See: The LINK Command Line
CMAKE error M0040
response-file name is null
The response-file name for a LINK command given in the make file is NULL.
See: The LINK Command Line
CMAKE error M0041
unable to open response file 'filename'
CMAKE could not open the response file for a LINK command given in the make file.
See: The LINK Command Line
CMAKE error M0042
not enough memory to load response file 'filename'
CMAKE ran out of memory while processing a LINK command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0043
executable-file name is null
The executable name provided in the response file for a LINK command given in the make file is NULL.
See: The LINK Command Line
CMAKE error M0044
object file 'filename' does not exist
CMAKE could not find one of the object files listed in the response file for a LINK command given in the make file.
See: The LINK Command Line
CMAKE error M0045
library file 'filename' does not exist
CMAKE could not find one of the library files listed in the response file for a LINK command given in the make file.
See: The LINK Command Line
CMAKE error M0046
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing a LINK command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0047
source-file name is null
The source-file name for a MASM command given in the make file is NULL.
See: The MASM Command Line
CMAKE error M0048
object-file name is null
The object-file name for a MASM command given in the make file is NULL.
See: The MASM Command Line
CMAKE error M0049
unable to open source file 'filename'
CMAKE could not open the source file for a MASM command given in the make file. CMAKE opens source files in order to search for include statements.
See: The MASM Command Line
CMAKE error M0050
unable to get time stamp for source file 'filename'
CMAKE could not obtain the time stamp for the source file of a MASM command given in the make file.
See: The MASM Command Line
CMAKE error M0051
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing a MASM command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0052
include file 'filename' not found... in source directory 'sourcedirectoryname' ... or INCLUDE environment variable paths... 'includepaths'
CMAKE could not find an include file while processing a MASM command given in the make file. In this case, the include-file name was appended to the source-file's directory and to the directories specified in the INCLUDE environment variable.
If your include file is located in the current directory, you should check to be sure that you have not set the configuration variable, search_current_dir_for_includes, to 'no' in your configuration file.
See: search_current_dir_for_includes Switches for MASM How CMAKE Processes an Assembly-Language-Source File
CMAKE error M0053
not enough memory to store include-file name 'filename'
CMAKE ran out of memory while processing a MASM command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0054
include level exceeds 9
Too many levels of nested include statements were used in the source file of a MASM command given in the make file. (The source file itself is level 0, a file that is included in the source file is level 1, etc.)
This usually indicates the presence of circular include statements.
CMAKE error M0055
unable to open include file 'filename'
CMAKE could not open an include file for a MASM command given in the make file. When the configuration variable, scan_include_files_for_includes, is 'yes', CMAKE opens include files in order to search for include statements.
If your include files do not have include statements, you should not set scan_include_files_for_includes to 'yes'.
See: scan_include_files_for_includes Switches for MASM How CMAKE Processes an Assembly-Language-Source File REM Avoid Scanning Include Files for Includes
CMAKE error M0056
source name is null
The source name for a COPY command given in the make file is NULL.
See: The COPY Command Line
CMAKE error M0057
target name is null
The target name for a COPY command given in the make file is NULL.
See: The COPY Command Line
CMAKE error M0058
source 'name' does not exist
CMAKE could not find the source of a COPY command given in the make file.
See: The COPY Command Line
CMAKE error M0059
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing a COPY command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0060
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing a COPY command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0061
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing a COPY command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0062
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing a COPY command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0063
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing a COPY command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0064
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing a COPY command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0065
source-file name is null
A source-file name for a user-defined command given in the make file is NULL.
See: How CMAKE Processes the Command Line of a User-Defined Command
CMAKE error M0066
target-file name is null
A target-file name for a user-defined command given in the make file is NULL.
See: How CMAKE Processes the Command Line of a User-Defined Command
CMAKE error M0067
unable to get time stamp for source file 'filename'
CMAKE could not obtain the time stamp for a source file of a user-defined command given in the make file.
See: How CMAKE Processes the Command Line of a User-Defined Command
CMAKE error M0068
not enough memory to store target-file name 'filename'
CMAKE ran out of memory while processing a user-defined command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0069
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing a user-defined command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0070
line too long in configuration file - length must be less than 255
A line in the configuration file exceeds the maximum length limit.
CMAKE error M0072
unrecognized configuration statement
A configuration statement was not recognized to be comment, assignment statement, command-definition statement, or command- equivalence statement.
See: The CMAKE Configuration File
CMAKE error M0073
right hand side of assignment statement must be 'yes' or 'no'
The right hand side of all assignment statements in the configuration file must be 'yes' or 'no'.
See: Syntax of Assignment Statements
CMAKE error M0074
not enough memory to store command definition
CMAKE ran out of memory while processing a command-definition statement in the configuration file.
Try eliminating any unnecessary command-definition and command- equivalence statements from your configuration file.
CMAKE error M0075
command name is null
The command name for a command-definition statement given in the configuration file is NULL.
See: Command-Definition Statements
CMAKE error M0076
command name too long - length must be no more than 8
The command name for a command-definition statement given in the configuration file is too long.
See: Command-Definition Statements
CMAKE error M0077
invalid parameter type - type must be 'sp' or 'fp'
An invalid parameter type was specified in a command-definition statement given in the configuration file.
See: Command-Definition Statements
CMAKE error M0078
missing file type delimiter '%' in stationary parameters
There is a missing file type delimiter in the stationary parameters for a command-definition statement given in the configuration file.
See: Command-Definition Statements
CMAKE error M0079
missing file type delimiter '%' in floating parameters
There is a missing file type delimiter in the floating parameters for a command-definition statement given in the configuration file.
See: Command-Definition Statements
CMAKE error M0080
invalid file type in stationary parameters - must be 'n', 's', or 't'
An invalid file type code was used in the stationary parameters for a command-definition statement given in the configuration file.
See: Command-Definition Statements
CMAKE error M0081
invalid file type in floating parameters - must be 'n', 's', or 't'
An invalid file type code was used in the floating parameters for a command-definition statement given in the configuration file.
See: Command-Definition Statements
CMAKE error M0082
open delimiter '[' expected after parameter type
An open delimiter, '[', was expected in a command-definition statement given in the configuration file.
See: Command-Definition Statements
CMAKE error M0083
closing delimiter ']' missing
A closing delimiter, ']', was expected in a command-definition statement given in the configuration file.
See: Command-Definition Statements
CMAKE error M0084
stationary parameters too long - must be sp['up-to-20-characters']
The stationary parameter string in a command-definition statement given in the configuration file is too long.
See: Command-Definition Statements
CMAKE error M0085
floating parameters too long - must be fp['up-to-20-characters']
The floating parameter string in a command-definition statement given in the configuration file is too long.
See: Command-Definition Statements
CMAKE error M0086
not enough memory to store command equivalence
CMAKE ran out of memory while processing a command-equivalence statement in the configuration file.
Try eliminating any unnecessary command-definition and command- equivalence statements from your configuration file.
CMAKE error M0087
command name is null
The command name for a command-equivalence statement given in the configuration file is NULL.
See: Command-Equivalence Statements
CMAKE error M0088
command name too long - length must be no more than 8
The command name for a command-equivalence statement given in the configuration file is too long.
See: Command-Equivalence Statements
CMAKE error M0089
equivalent-command name is null
The equivalent-command name (i.e. right hand side) for a command- equivalence statement given in the configuration file is NULL.
See: Command-Equivalence Statements
CMAKE error M0090
equivalent-command name too long - length must be no more than 8
The equivalent-command name (i.e. right hand side) for a command- equivalence statement given in the configuration file is too long.
See: Command-Equivalence Statements
CMAKE error M0091
unrecognized equivalent command
The equivalent-command name (i.e. right hand side) for a command- equivalence statement given in the configuration file is unrecognized.
The equivalent-command name must be either an intrinsic command (e.g. CL, LINK, LIB, MASM,...) or a user-defined command that has been defined in a previous command-definition statement.
See: Command-Equivalence Statements
CMAKE error M0092
include file 'filename' not found... in INCLUDE environment variable paths... 'includepaths'
CMAKE could not find an include file while processing a MASM command given in the make file. In this case, the include-file name was appended to the directories specified in the INCLUDE environment variable.
If your include file is located in the current directory, you should check to be sure that you have not set the configuration variable, search_current_dir_for_includes, to 'no' in your configuration file.
If your include file is located in the source-file's directory, you should check to be sure that you have not set the configuration variable, search_source_dir_for_includes, to 'no' in your configuration file.
See: search_current_dir_for_includes search_source_dir_for_includes Switches for MASM How CMAKE Processes an Assembly-Language-Source File
CMAKE error M0093
not enough memory to store environment string address
CMAKE ran out of memory while processing a SET command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0094
not enough memory to store environment string
CMAKE ran out of memory while processing a SET command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0095
environment variable name is null
The environment variable name in a SET statement given in the make file is NULL.
See: SET
CMAKE error M0098
'(' expected after 'if'
The character, '(', is missing in an if statement given in the make file.
See: Syntax of the if Statement
CMAKE error M0100
not enough memory to store target-file name 'filename'
CMAKE ran out of memory while processing an if statement given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0101
unable to get time stamp for source file 'filename'
CMAKE could not obtain the time stamp for a source file of an if statement given in the make file.
See: Syntax of the if Statement
CMAKE error M0102
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing an if statement given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0103
line too long - length must be less than 255
A command line given in the make file exceeds the maximum length limit.
CMAKE error M0104
not enough memory to create predefined pseudofile 'filename'
CMAKE ran out of memory while attempting to create the predefined pseudofile, "start.psf".
You do not have enough memory available to execute CMAKE.
CMAKE error M0105
comments may not be nested
Nested C-style comments (/* */) were detected in the make file. C-style comments may not be nested.
See: Comments in the Make File
CMAKE error M0106
module-definition file 'filename' does not exist
CMAKE could not find the module-definition file listed in the response file for a LINK command given in the make file.
See: The LINK Command Line
CMAKE error M0107
include file 'filename' not found in current directory... 'currentdirectoryname', source directory 'sourcedirectoryname' ... or INCLUDE environment variable paths... 'includepaths'
CMAKE could not find an include file while processing a MASM command given in the make file. In this case, the include-file name was appended to the current directory, the source-file's directory and the directories specified in the INCLUDE environment variable.
See: How CMAKE Processes an Assembly-Language-Source File
CMAKE error M0108
include file 'filename' not found in current directory... 'currentdirectoryname' or INCLUDE environment variable paths... 'includepaths'
CMAKE could not find an include file while processing a MASM command given in the make file. In this case, the include-file name was appended to the current directory and to the directories specified in the INCLUDE environment variable.
If your include file is located in the source-file's directory, you should check to be sure that you have not set the configuration variable, search_source_dir_for_includes, to 'no' in your configuration file.
See: search_source_dir_for_includes Switches for MASM How CMAKE Processes an Assembly-Language-Source File
CMAKE error M0109
resource-script-file name is null
The resource-script-file name for an RC/C command given in the make file is NULL.
See: The RC/C Command Line
CMAKE error M0110
resource-file name is null
The resource-file name for an RC/C command given in the make file is NULL.
See: The RC/C Command Line
CMAKE error M0111
unable to open resource-script file 'filename'
CMAKE could not open the resource-script file for an RC/C command given in the make file. CMAKE opens resource-script files in order to search for #include statements and resource-include statements.
See: The RC/C Command Line
CMAKE error M0112
unable to get time stamp for resource-script file 'filename'
CMAKE could not obtain the time stamp for the resource-script file of an RC/C command given in the make file.
See: The RC/C Command Line
CMAKE error M0113
resource-file name is null
The resource-file name for an RC/A command given in the make file is NULL.
See: The RC/A Command Line
CMAKE error M0114
executable-file name is null
The executable-file name for an RC/A command given in the make file is NULL.
See: The RC/A Command Line
CMAKE error M0115
unable to get time stamp for executable file 'filename'
CMAKE could not obtain the time stamp for the executable file of an RC/A command given in the make file.
See: The RC/A Command Line
CMAKE error M0116
unable to get time stamp for resource file 'filename'
CMAKE could not obtain the time stamp for the resource file of an RC/A command given in the make file.
See: The RC/A Command Line
CMAKE error M0117
target-file name is null
The target-file name for an RC/W command given in the make file is NULL.
See: The RC/W Command Line
CMAKE error M0118
unable to get time stamp for target file 'filename'
CMAKE could not obtain the time stamp for the target file of an RC/W command given in the make file.
See: The RC/W Command Line
CMAKE error M0119
cannot determine RC operation
CMAKE could not determine the operation type of an RC command given in the make file.
See: RC Operations The RC/C Command Line The RC/A Command Line The RC/W Command Line
CMAKE error M0120
not enough memory to create pseudofile 'filename'
CMAKE ran out of memory while processing an RC command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0121
include file 'filename' not found in current directory... 'currentdirectoryname' or INCLUDE environment variable paths... 'includepaths'
CMAKE could not find an include file while processing an RC/C command given in the make file. In this case, the include-file name was appended to the current directory and to the directories specified in the INCLUDE environment variable.
See: How CMAKE Processes a Resource-Script File
CMAKE error M0122
include file 'filename' not found... in INCLUDE environment variable paths... 'includepaths'
CMAKE could not find an include file while processing an RC/C command given in the make file. In this case, the include-file name was appended to the directories specified in the INCLUDE environment variable.
If your include file is located in the current directory, you should check to be sure that you have not set the configuration variable, search_current_dir_for_includes, to 'no' in your configuration file.
See: search_current_dir_for_includes Switches for RC/C How CMAKE Processes a Resource-Script File
CMAKE error M0123
not enough memory to store include-file name 'filename'
CMAKE ran out of memory while processing an RC/C command given in the make file.
Try splitting your make file into two smaller make files that are processed with two consecutive calls to CMAKE.
CMAKE error M0124
include level exceeds 9
Too many levels of nested include statements were used in the resource-script file of an RC/C command given in the make file. (The resource-script file itself is level 0, a file that is included in the resource-script file is level 1, etc.)
This usually indicates the presence of circular include statements.
CMAKE error M0125
unable to open include file 'filename'
CMAKE could not open an include file for an RC/C command given in the make file. When the configuration variable, scan_include_files_for_includes, is 'yes', CMAKE opens include files in order to search for #include statements and resource- include statements.
If your include files do not have include statements, you should not set scan_include_files_for_includes to 'yes'.
See: scan_include_files_for_includes Switches for RC/C How CMAKE Processes a Resource-Script File REM Avoid Scanning Include Files for Includes
CMAKE error M0127
unexpected end-of-file
An unexpected end-of-file was reached while processing the response file for a LIB command given in the make file.
Check to be sure that the last line in the response file does not end with the character, '&'.
See: The LIB Command Line
CMAKE error M0128
unexpected end-of-file
An unexpected end-of-file was reached while processing the response file for a LIB command given in the make file.
Check to be sure that the last line in the response file does not end with the character, '&'.
See: The LIB Command Line
CMAKE error M0129
unexpected end-of-file
An unexpected end-of-file was reached while processing the response file for a LINK command given in the make file.
Check to be sure that the executable-file name has not been omitted from the response file.
Check to be sure that the last line in the response file does not end with the character, '+'.
See: The LINK Command Line
CMAKE error M0130
unexpected end-of-file
An unexpected end-of-file was reached while processing the response file for a LINK command given in the make file.
Check to be sure that the last line in the response file is terminated with the character, ';'.
See: The LINK Command Line
CMAKE error M0131
unexpected end-of-file
An unexpected end-of-file was reached while processing the response file for a LINK command given in the make file.
Check to be sure that the last line in the response file is terminated with the character, ';'.
See: The LINK Command Line
CMAKE error M0132
unexpected end-of-file
An unexpected end-of-file was reached while processing the response file for a LINK command given in the make file.
Check to be sure that the last line in the response file is terminated with the character, ';'.
See: The LINK Command Line
CMAKE error M0133
unexpected end-of-file
An unexpected end-of-file was reached while processing the response file for a LINK command given in the make file.
Check to be sure that the last line in the response file does not end with the character, '+'.
See: The LINK Command Line
CMAKE error M1000
token truncated to 'token' - maximum token length is 67
There is a token in the make file that is too long.
CMAKE error M1001
unexpected end-of-file
An unexpected end-of-file was reached while processing an if statement given in the make file.
See: Syntax of the if Statement
CMAKE error M1002
token truncated to 'token' - maximum token length is 67
There is a token in the make file that is too long. This was discovered while processing an if statement in the make file.
CMAKE error M1003
unexpected end-of-file
An unexpected end-of-file was reached while processing an if statement given in the make file.
See: Syntax of the if Statement
CMAKE error M1004
token truncated to 'token' - maximum token length is 67
There is a token in the make file that is too long. This was discovered while processing an if statement in the make file.
CMAKE error M1005
unexpected end-of-file
An unexpected end-of-file was reached while processing an if statement given in the make file.
See: Syntax of the if Statement
CMAKE error M1006
token truncated to 'token' - maximum token length is 67
There is a token in the make file that is too long. This was discovered while processing an if statement in the make file.
CMAKE error M1007
unexpected end-of-file
An unexpected end-of-file was reached while processing an if statement given in the make file.
See: Syntax of the if Statement
CMAKE error M1008
token truncated to 'token' - maximum token length is 67
There is a token in the make file that is too long. This was discovered while processing an if statement in the make file.
CMAKE error M1009
unexpected end-of-file
An unexpected end-of-file was reached while processing an if statement given in the make file.
See: Syntax of the if Statement
CMAKE error M1010
token truncated to 'token' - maximum token length is 67
There is a token in the make file that is too long. This was discovered while processing an if statement in the make file.
CMAKE error M1011
unexpected end-of-file
An unexpected end-of-file was reached while processing an if statement given in the make file.
Check to be sure that you have not omitted the terminating bracket, '}', from an if statement in your make file. Check your last if statement first.
See: Syntax of the if Statement
CMAKE error M1012
token truncated to 'token' - maximum token length is 67
There is a token in the make file that is too long. This was discovered while processing an if statement in the make file.
Copyright and Trademarks
Copyright
(c) Copyright John Greschak 1991.
Registered Trademarks
Microsoft and MS-DOS are registered trademarks of Microsoft Corporation.
CompuServe is a registered trademark of CompuServe, Inc.
BRIEF is a registered trademark of UnderWare, Inc.
Trademarks
Windows is a trademark of Microsoft Corporation.
Epsilon is a trademark of Lugaru Software, Ltd.
CMAKE Index
/a option Display Information about CMAKE
asm_include_on asm_include_on Switches for MASM How CMAKE Processes an ASM-Source File
assignment statements Assignment Statements in the Configuration File
author Technical Support for CMAKE Display Information about CMAKE
Boolean variables Boolean Variables
BRIEF Error Messages (Viewing) Using CMAKE with BRIEF
c_include_""_on c_include_""_on Switches for CL How CMAKE Processes a C-Source File
c_include_<>_on c_include_<>_on Switches for CL Avoid Checking System-Include Dependencies How CMAKE Processes a C-Source File
CL CL
CMAKE_CFG environment variable How CMAKE Locates the Configuration File
/* CMAKE - INCLUDE END */ How CMAKE Processes a C-Source File Switches for CL How CMAKE Processes a Resource-Script File Switches for RC/C Helpful Hints for RC/C Use the End-of-Includes Comment
/* CMAKE - INCLUDE "" ON/OFF */ How CMAKE Processes a C-Source File Switches for CL Some Restrictions on CL How CMAKE Processes a Resource-Script File Switches for RC/C Some Restrictions on RC/C rc_include_""_on c_include_""_on
/* CMAKE - INCLUDE <> ON/OFF */ How CMAKE Processes a C-Source File Switches for CL How CMAKE Processes a Resource-Script File Switches for RC/C c_include_<>_on rc_include_<>_on Avoid Checking System-Include Dependencies
/* CMAKE - INCLUDE RESOURCE ON/OFF */ How CMAKE Processes a Resource-Script File Switches for RC/C Helpful Hints for RC/C rc_include_resource_on
; CMAKE - INCLUDE END How CMAKE Processes an ASM-Source File Switches for MASM Use the End-of-Includes Comment
; CMAKE - INCLUDE ON/OFF How CMAKE Processes an ASM-Source File Switches for MASM asm_include_on
"cmake.cfg" How CMAKE Locates the Configuration File Help CMAKE Find Configuration Data Quickly
INCLUDE environment variable How CMAKE Processes a C-Source File Switches for CL How CMAKE Processes an ASM-Source File Switches for MASM How CMAKE Processes a Resource-Script File Switches for RC/C search_source_dir_for_includes search_current_dir_for_includes
include statements How CMAKE Processes a C-Source File How CMAKE Processes an ASM-Source File How CMAKE Processes a Resource-Script File
input file Interpreting the Output of CMAKE
intrinsic commands Intrinsic Commands
LIB LIB
LIB environment variable The LINK Command Line Samples: Microsoft Windows SDK
LINK LINK
local-include statements How CMAKE Processes a C-Source File How CMAKE Processes a Resource-Script File
"makefile" Specify the Make-File Name
"makefile.bat" How CMAKE Works Interpreting the Output of CMAKE Suppress Command Execution by CMAKE Specify the Path of "makefile.bat" run_output_file display_output_file_commands Have CMAKE Put "makefile.bat" on a RAM Drive
make file Creating a Make File Specify the Make-File Name The Make File
MASM MASM
The Microsoft Editor Error Messages Using CMAKE with The Microsoft Editor
/n option Suppress Command Execution by CMAKE run_output_file
/o option Specify the Path of "makefile.bat" The CMAKE Command Line: Examples Have CMAKE Put "makefile.bat" on a RAM Drive
options The CMAKE Command Line
output Interpreting the Output of CMAKE Select Verbose Diagnostic Output from CMAKE Avoid Using the Verbose Output Format for CMAKE Redirect CMAKE Output to a File on a RAM Drive
output file Interpreting the Output of CMAKE
PATH environment variable Display Help on CMAKE
predefined pseudofiles Pseudofiles for User-Defined Commands Pseudofiles for the if Statement
pseudofiles How CMAKE Works
QH Display Help on CMAKE
QuickHelp Display Help on CMAKE
RC RC
RC/A RC/A
RC/C RC/C
RC/CA RC/CA
RC/W RC/W
rc_include_""_on rc_include_""_on Switches for RC/C How CMAKE Processes a Resource-Script File
rc_include_<>_on rc_include_<>_on Switches for RC/C How CMAKE Processes a Resource-Script File
rc_include_resource_on rc_include_resource_on Switches for RC/C How CMAKE Processes a Resource-Script File
registered users Display Information about CMAKE
REM REM
REM CMAKE - SCAN INCLUDE FILES FOR INCLUDES ON/OFF Switches for CL How CMAKE Processes a C-Source File Switches for MASM How CMAKE Processes an ASM-Source File Switches for RC/C How CMAKE Processes a Resource-Script File REM scan_include_files_for_includes Avoid Scanning Include Files for Includes
resource-include statements How CMAKE Processes a Resource-Script File
response files The LIB Command Line The LINK Command Line
run_output_file run_output_file Suppress Command Execution by CMAKE
scan_include_files_for_includes scan_include_files_for_includes Switches for CL How CMAKE Processes a C-Source File Switches for MASM How CMAKE Processes an ASM-Source File Switches for RC/C How CMAKE Processes a Resource-Script File REM Avoid Scanning Include Files for Includes
search_current_dir_for_includes search_current_dir_for_includes Switches for MASM How CMAKE Processes an ASM-Source File Switches for RC/C How CMAKE Processes a Resource-Script File Help CMAKE Find Include Files Quickly
search_source_dir_for_includes search_source_dir_for_includes Switches for CL How CMAKE Processes a C-Source File Switches for MASM How CMAKE Processes an ASM-Source File Help CMAKE Find Include Files Quickly
sensitivity to include statements How CMAKE Processes a C-Source File How CMAKE Processes an ASM-Source File How CMAKE Processes a Resource-Script File
SET SET
shareware Display Information about CMAKE
SORT Command-Definition Statements: Examples
source files How CMAKE Works
"start.psf" Pseudofiles for User-Defined Commands Pseudofiles for the if Statement