UNIX and Win32 binaries (both 32- and 64-bit) can be built using CMake.
CMake is an open-source tool like automake - it generates
makefiles.
CMake (as of v3.14.5) is able to generate:
- Borland Makefiles
- MSYS Makefiles
- MinGW Makefiles
- NMake Makefiles
- Unix Makefiles
- Visual Studio 16 2019
- Visual Studio 15 2017
- Visual Studio 14 2015
- Visual Studio 12 2013
- Visual Studio 11 2012
- Visual Studio 10 2010
- Visual Studio 9 2008
- Watcom WMake
The steps are:
-
Install cmake (e.g. from cmake.org);
-
Add directory containing
cmakeexecutable toPATHenvironment variable; -
Run cmake from the bdwgc root directory, passing the target with
-Goption - e.g. typecmake -G "Visual Studio 9 2008"and use thegc.slnfile generated by cmake to buildgclibrary.
Notes:
-
Specify
-D enable_cplusplus=ONoption to buildgccppandgctbalibraries (i.e. the ones that provide bdwgc C++ support); -
Specify
-D BUILD_TESTING=OFFoption to skip compilation of the tests.
You can also run cmake from a build directory to build outside of the root of the source tree - just specify the path to the latter, e.g.:
mkdir build
cd build
cmake -G "Visual Studio 9 2008" ..
cmake --build . --config Release
ctest --build-config Release -VHere is a sample for Linux (build, test and install, w/o C++ support):
mkdir build
cd build
cmake ..
cmake --build .
ctest
make installThe main input to cmake is CMakeLists.txt file (script) in the bdwgc root
directory. For help, go to cmake.org.
Another project could add bdwgc (of the required version) as one of its
dependencies with something like this in their CMakeLists.txt file:
find_package(BDWgc <version> REQUIRED)
add_executable(Foo foo.c)
target_link_libraries(Foo BDWgc::gc)Other exported libraries are: cord, gccpp, gctba.