2001-01-12 15:43:28 +03:00
|
|
|
WELCOME TO CROSS-PLATFORM MAKE
|
|
|
|
|
|
|
|
CMake is a cross-platform, extensible build environment. It currently generates
|
|
|
|
Unix makefiles and Microsoft Visual C++ projects/workspaces.
|
|
|
|
|
|
|
|
To use CMake, create CMakeLists.txt in each directory that makes up your
|
|
|
|
source repository. The CMakeLists.txt contains rules. Each rule does something
|
|
|
|
different, like defines a list of source code, include directories, etc. Once
|
|
|
|
CMake has processed all the rules in all the CMakeLists.txt files, it generates
|
|
|
|
the appropriate "makefile(s)" for the system/compiler that you are on.
|
|
|
|
|
|
|
|
THE BOOK OF RULES
|
|
|
|
The key to using CMake is to learn the rules. Each rule has the same format:
|
|
|
|
|
|
|
|
NAME_OF_RULE(args....)
|
|
|
|
|
|
|
|
where args is a white-space separated listed of arguments. (Arguments
|
|
|
|
containing spaces should be quoted. For example:
|
|
|
|
|
|
|
|
INCLUDE_DIRECTORIES(./ d:/include "c:/Program Files/include")
|
|
|
|
|
|
|
|
note that Unix-style slashes are used.
|
|
|
|
|
|
|
|
Here are the important rules.
|
2000-08-29 23:26:29 +04:00
|
|
|
|
2000-09-18 17:19:38 +04:00
|
|
|
# build targets
|
2001-01-12 15:43:28 +03:00
|
|
|
WIN32_SOURCE_FILES(file1 file2 ...)
|
|
|
|
|
|
|
|
UNIX_SOURCE_FILES()
|
|
|
|
|
|
|
|
ABSTRACT_CLASSES(class1 class2 ...)
|
|
|
|
|
|
|
|
SUBDIRS()
|
|
|
|
|
|
|
|
EXECUTABLES()
|
|
|
|
|
|
|
|
# name of the library to build
|
|
|
|
LIBRARY(library_name)
|
|
|
|
|
2000-09-18 17:19:38 +04:00
|
|
|
# make flags
|
2001-01-12 15:43:28 +03:00
|
|
|
# make flags can use these variables:
|
2000-09-18 17:19:38 +04:00
|
|
|
# ${CMAKE_BINARY_DIR} The root of the build tree where the binaries are
|
2000-11-09 18:41:37 +03:00
|
|
|
# ${CMAKE_SOURCE_DIR} The root of the source tree where configure is
|
2000-09-18 17:19:38 +04:00
|
|
|
|
2001-01-12 15:43:28 +03:00
|
|
|
INCLUDE_DIRECTORIES()
|
2000-09-18 17:19:38 +04:00
|
|
|
|
2001-01-12 15:43:28 +03:00
|
|
|
LINK_DIRECTORIES()
|
|
|
|
|
|
|
|
LINK_LIBRARIES() = # use the same name as the LIBRARY() rule specified
|
|
|
|
WIN32_LIBRARIES()
|
|
|
|
UNIX_LIBRARIES()
|
|
|
|
|
|
|
|
# define other targtes/source directories
|
|
|
|
AUX_SOURCE_DIR(dir1 dir2 ...)
|
2000-08-31 14:36:18 +04:00
|
|
|
|
|
|
|
Windows / Visual Studio 6.0 programs
|
|
|
|
CMakeSetup.exe -> window MFC based GUI for configure on windows
|
|
|
|
CMakeSetupCMD.exe -> windows command line version of CMakeConfigure
|
2001-01-12 15:43:28 +03:00
|
|
|
|
2000-08-31 14:36:18 +04:00
|
|
|
To Build on Windows:
|
|
|
|
load CMake/Source/CMakeSetup.dsw
|
|
|
|
Build it
|
|
|
|
Run it
|
|
|
|
Specify paths
|
|
|
|
|
|
|
|
Load ITK.dsw
|
|
|
|
Build Common, Numerics, then any of the many executables, or do a Batch build
|
|
|
|
with debug only.
|
|
|
|
|
|
|
|
|
|
|
|
Unix scripts and programs:
|
|
|
|
configure -> run on unix to configure for build
|
|
|
|
CMakeBuildTargets -> Unix program to read CMakeLists.txt and generate CMakeTargets.make
|
|
|
|
makefile fragments:
|
|
|
|
CMakeMaster.make -> main file to be included by makefiles
|
|
|
|
CMakeVariables.make -> all make varibles are set in this file
|
2000-09-12 13:30:35 +04:00
|
|
|
CMakeRules.make -> All build rules are here (except Simple Rules)
|
|
|
|
CMakeSimpleRules.make -> simple build rules for .o to .cxx, this is separate to be able
|
|
|
|
to build CMakeBuildTargets itself.
|
2000-08-31 14:36:18 +04:00
|
|
|
CMakeLocal.make -> Place for hand configuration
|
2000-09-12 13:30:35 +04:00
|
|
|
CMakeTargets.make -> generated rules for make style build in each directory
|
2000-08-31 14:36:18 +04:00
|
|
|
MakefileTemplate.make -> master makefile template used by configure to generate Makefiles
|
|
|
|
|
2000-09-28 20:43:15 +04:00
|
|
|
|
2000-08-31 14:36:18 +04:00
|
|
|
Unix install:
|
|
|
|
In place:
|
|
|
|
./configure
|
|
|
|
make
|
|
|
|
|
|
|
|
Other directory:
|
|
|
|
mkdir Insight-build
|
|
|
|
cd Insight-build
|
|
|
|
../Insight/configure
|
|
|
|
make
|
|
|
|
|
|
|
|
|
2000-08-29 23:26:29 +04:00
|
|
|
TODO:
|
2000-09-21 21:45:08 +04:00
|
|
|
|
2000-09-27 23:01:19 +04:00
|
|
|
FEATURES:
|
2000-09-21 21:45:08 +04:00
|
|
|
Add include and directories to the build on windows.
|
|
|
|
For unix just add them to the CMakeLocal.make.in
|
|
|
|
Add a --with idea, sets a #define in the config.h file
|
2000-11-04 00:38:44 +03:00
|
|
|
Create a directory
|
|
|
|
Run a command
|
2000-09-21 21:45:08 +04:00
|
|
|
|
2000-09-27 23:01:19 +04:00
|
|
|
CLEANUP:
|
2000-09-21 21:45:08 +04:00
|
|
|
Change ME to LIBRARY, and add PROJECT=
|
2000-09-27 23:01:19 +04:00
|
|
|
Remove the rest of the ITK_* stuff
|
|
|
|
move the libs used from the top into the testing...
|
2000-08-31 14:36:18 +04:00
|
|
|
|
2000-11-04 00:38:44 +03:00
|
|
|
|
|
|
|
FEATURES
|
|
|
|
1. run a command in the current build directory
|
|
|
|
2. make a directory
|
|
|
|
3. search for 3rd party software and define some variables
|
|
|
|
that can be used in the CMakeLists.txt files. Perhaps from
|
|
|
|
some central CMake.in file.
|
|
|
|
4. Have cmake define some stuff like:
|
|
|
|
SITE, OS-REV, COMPILER-VERSION
|
|
|
|
(use configure for unix, and add stuff to the pc version for windows.)
|
|
|
|
|
|
|
|
BUGS:
|
|
|
|
1. allow multiple registry entries on windows
|
|
|
|
|