|
Packit |
0b5880 |
This is the "money example" from the Check tutorial.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
This demonstrates using Check along with one of two build systems:
|
|
Packit |
0b5880 |
autotools and CMake.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
========================
|
|
Packit |
0b5880 |
Autotools:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
You need the following programs installed on your system:
|
|
Packit |
0b5880 |
-- Autoconf 2.59
|
|
Packit |
0b5880 |
-- Automake 1.9.6
|
|
Packit |
0b5880 |
-- Libtool 1.5.22
|
|
Packit |
0b5880 |
-- Check 0.9.9
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Somewhat earlier versions of these programs might work.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Then, do as follows:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
$ autoreconf --install
|
|
Packit |
0b5880 |
$ ./configure
|
|
Packit |
0b5880 |
$ make
|
|
Packit |
0b5880 |
$ make check
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Don't do "make install" unless you want to install the money example.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
money.c and money.h are built as a library. src/main.c:main() is a
|
|
Packit |
0b5880 |
client of libmoney.la, just as tests/check_money.c:main() is a client
|
|
Packit |
0b5880 |
of libmoney.la
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
To use the autotools example in another project, start with the following
|
|
Packit |
0b5880 |
files:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
example
|
|
Packit |
0b5880 |
|--- configure.ac
|
|
Packit |
0b5880 |
|--- Makefile.am
|
|
Packit |
0b5880 |
|--- src
|
|
Packit |
0b5880 |
| |--- Makefile.am
|
|
Packit |
0b5880 |
|--- tests
|
|
Packit |
0b5880 |
|--- Makefile.am
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Please send bug reports to check-devel AT lists.sourceforge.net.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
========================
|
|
Packit |
0b5880 |
CMake:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
You need the following programs installed on your system:
|
|
Packit |
0b5880 |
-- CMake 2.8
|
|
Packit |
0b5880 |
-- Check 0.9.9
|
|
Packit |
0b5880 |
-- (pkg-config 0.26 is optional)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Somewhat earlier versions of these programs might work.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
NOTE: If pkg-config is not installed on the system, and MSVC is being used,
|
|
Packit |
0b5880 |
the install location of Check must be inserted manually into the
|
|
Packit |
0b5880 |
tests/CMakeLists.txt file, by setting the variable CHECK_INSTALL_DIR
|
|
Packit |
0b5880 |
to the install location. Look at the tests/CMakeLists.txt file for
|
|
Packit |
0b5880 |
a commented out example.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Then, do as follows for a Unix-compatible shell:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
$ cmake .
|
|
Packit |
0b5880 |
$ make
|
|
Packit |
0b5880 |
$ make test
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
or the following for MSVC:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
$ cmake -G "NMake Makefiles" .
|
|
Packit |
0b5880 |
$ nmake
|
|
Packit |
0b5880 |
$ nmake test
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Don't do "make install" or "nmake install" unless you want to install the money example.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
money.c and money.h are built as a library. src/main.c:main() is a
|
|
Packit |
0b5880 |
client of libmoney.la, just as tests/check_money.c:main() is a client
|
|
Packit |
0b5880 |
of libmoney.la
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
To use the CMake example in another project, start with the following files:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
example
|
|
Packit |
0b5880 |
|--- CMakeFiles.txt
|
|
Packit |
0b5880 |
|--- cmake
|
|
Packit |
0b5880 |
| |--- config.h.in
|
|
Packit |
0b5880 |
| |--- FindCheck.cmake
|
|
Packit |
0b5880 |
|--- src
|
|
Packit |
0b5880 |
| |--- CMakeFiles.txt
|
|
Packit |
0b5880 |
|--- tests
|
|
Packit |
0b5880 |
|--- CMakeFiles.txt
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Please send bug reports to check-devel AT lists.sourceforge.net.
|