ENH:Commands not rules

This commit is contained in:
Will Schroeder 2001-01-18 13:43:27 -05:00
parent ae1cc5252b
commit 2fcbbdf39f
1 changed files with 49 additions and 30 deletions

79
README
View File

@ -1,29 +1,32 @@
WELCOME TO CROSS-PLATFORM MAKE (CMake) WELCOME TO CROSS-PLATFORM MAKE (CMake)
------------------------------------- -------------------------------------
CMake is a cross-platform, extensible build environment. It currently generates CMake is a cross-platform, extensible build environment. It currently
Unix makefiles and Microsoft Visual C++ projects/workspaces. generates Unix makefiles and Microsoft Visual C++ projects/workspaces. Other
OS/compiler targets are being added to this open-source system, and you can
add your own, if desired.
To use CMake, create CMakeLists.txt in each directory that makes up your To use CMake, create CMakeLists.txt in each directory that makes up your
source repository. The CMakeLists.txt file contains rules. Each rule does source repository. The CMakeLists.txt file contains commands. Each command
something different, like defining a list of source code, include directories, does something different, like defining a list of source code, include
etc. Once CMake has processed all the rules in all the CMakeLists.txt files, directories, makefile targets, rules, etc. Once CMake has processed all the
it generates the appropriate "makefile(s)" for the system/compiler that you commands in all the CMakeLists.txt files, it generates the appropriate
are on. "makefile(s)" for the system/compiler that you are on.
THE BOOK OF RULES CMake Commands
----------------- --------------
The key to using CMake is to learn the rules. Each rule has the same format: The key to using CMake is to learn the commands. Each command has the
same format:
NAME_OF_RULE(args....) NAME_OF_COMMAND(args....)
where args is a white-space separated listed of arguments. (Arguments where args is a white-space separated listed of arguments. (Arguments
containing spaces should be quoted). For example: containing spaces should be quoted). For example:
INCLUDE_DIRECTORIES(./ d:/include "c:/Program Files/include") INCLUDE_DIRECTORIES(./ d:/include "c:/Program Files/include")
note that Unix-style slashes are used. The rules may reference CMake note that Unix-style slashes are used. The commands may reference CMake
variables, either built-in or defined variables. Two important variables variables, either built-in or defined variables. Two important variables
are built-in to CMake: are built-in to CMake:
@ -40,11 +43,11 @@ A rule might reference these as follows:
using the ${} delimiters. using the ${} delimiters.
Here is a list of current rules. You may also wish to view Here is a list of current commands. You may also wish to view
the Doxygen documentation (if available) or generate it with the Doxygen documentation (if available) or generate it with
the doxygen.config file in this directory. the doxygen.config file in this directory.
Rules: (Generated with cmDumpDocumentation) Rules: (Generated with cmDumpDocumentation.cxx)
------------------------------------------ ------------------------------------------
ABSTRACT_FILES - A list of abstract classes, useful for wrappers. ABSTRACT_FILES - A list of abstract classes, useful for wrappers.
@ -81,13 +84,13 @@ Rules: (Generated with cmDumpDocumentation)
The directories can use built in definitions like The directories can use built in definitions like
CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR. CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR.
LINK_LIBRARIES - Specify a list of libraries to be linked into executables or LINK_LIBRARIES - Specify a list of libraries to be linked into executables
shared objects. or shared objects.
Usage: LINK_LIBRARIES(library1 library2) Usage: LINK_LIBRARIES(library1 library2)
Specify a list of libraries to be linked into Specify a list of libraries to be linked into
executables or shared objects. This rule is passed executables or shared objects. This command is passed
down to all other rules. The library name should be down to all other commands. The library name should be
the same as the name used in the LIBRARY(library) rule. the same as the name used in the LIBRARY(library) command.
PROJECT - Set a name for the entire project. One argument. PROJECT - Set a name for the entire project. One argument.
Usage: PROJECT(projectname) Usage: PROJECT(projectname)
@ -139,11 +142,10 @@ To build a project on Windows:
load CMake/Source/CMakeSetup.dsw load CMake/Source/CMakeSetup.dsw
Build it Build it
Run it Run it
Specify paths Specify paths (i.e., CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR)
Load ITK.dsw Load (project).dsw (the PROJECT(project) command specified the name)
Build Common, Numerics, then any of the many executables, Build the appropriate workspaces wihin the project.
or do a Batch build with debug only.
Unix: Unix:
@ -169,20 +171,37 @@ These programs/files are used to drive CMake on Unix:
Unix install: Unix install:
In place (object files end up in source code directory): In-place builds (object files end up in source code directory):
./configure ./configure
make make
Other directory (object files are in another directory): Other-directory builds (object files are in another directory, and
assuming that the source code is in ./project and the following
procedure is performed starting in directory ./):
mkdir Insight-build mkdir project-build (project is the name of your project)
cd Insight-build cd project-build
../Insight/configure ../project/configure
make make
ADDING COMMANDS
---------------
Rules can be added to CMake by deriving new commands from the class cmCommand
(defined in CMake/Source/cmCommand.h/.cxx).
ADDING MAKEFILE SUPPORT
-----------------------
Different types of makefiles (corresponding to a different compiler and/or
operating system) can be added by subclassing from cmMakefileGenerator
(defined in cmMakefileGenerator.h/.cxx). Makefile generators process the
information defined by the commands in CMakeLists.txt to generate the
appropriate makefile(s).
FOR MORE INFORMATION FOR MORE INFORMATION
-------------------- --------------------
Contact Bill Hoffman bill.hoffman@kitware.com who is the Contact Bill Hoffman bill.hoffman@kitware.com (principal developer)
principal developer. or Will Schroeder will.schroeder@kitware.com (documentation grunt).