Here are your alternatives for installing Cgreen
.
Cgreen is available for [some Linux distros] (https://repology.org/project/cgreen/versions). If you are on one of those you can do
$ sudo apt install cgreen1
or equivalent. Not all distros have an up-to-date version.
There are occassionally pre-built binaries available from the GitHub repo. You can download and install these using an appropriate package manager.
Clone the Cgreen
repo
$ git clone https://github.com/cgreen-devs/cgreen
or get the source from the same place.
Then build it
$ cd cgreen
$ make
The Makefile is mainly for convenience as Cgreen
is actually built
using CMake
. So you can tweak the build using normal CMake
settings.
You can run some tests using
$ make unit
$ make test
NOTE: to also build the dynamically auto-discovering runner
cgreen-runner
, which make unit
uses, you need binutils
as per
the description in the README.md.
You also have some extra options available
- build with static libraries
- build HTML or PDF documentation
To enable any of these use the CMake
graphical user interface (CMakeSetup
on Windows or ccmake on UNIX) to turn these options on or off.
Note on CYGWIN: Cygwin is not a WIN32 platform, but it is a DLL-platform where libraries normally goes in the bin directory. Running the self-tests handles this automatically but if you want to use the binaries in the 'build'-tree you can either:
-
install before running the tests and also set your PATH to include "/usr/local/lib"
-
setting the PATH to include the build directory where the libraries are there is a sh-compatible command script to do that for you. From the top of the Cgreen source directory do:
. cygwin-setup.sh
You can use Cgreen
from the source tree without actually
installing. Just set your compilation includes to include
<path_to_cgreen>/include
and link with the built library by pointing
the linker to <path_to_cgreen>/build/src/
and use -lcgreen
. E.g.
$ cc ... -I/home/me/cgreen/include ...
$ cc ... -L/home/me/cgreen/build/src -lcgreen ...
You can also install Cgreen
with
$ make install
which will install Cgreen
in what CMake
considers standard
locations for your environment. Assuming that is /usr/local
you
should now be able to compile and link using
$ cc ... -I/usr/local/include ...
$ cc ... -L/usr/local/lib -lcgreen ...