CopperSpice Overview
Annex Files vs System Libraries

The CsCore library depends on functionality in CsLibGuarded, CsSignal, and the CsString libraries. Files from each of these libraries are embedded in the CopperSpice source code. The files are located in the following CopperSpice directories.

  • CsLibGuarded source files
    • src/annex/cs_libguarded
  • CsSignal source files
    • src/annex/cs_signal
  • CsString source files
    • src/annex/cs_string

Exported CMake Variable

Each library has an exported CMake variable which defines the location where the include files will be installed. This variable can be imported and used from other CMake projects, such as CsCore. The following are the variable names for each library.

  • CsLibGuarded_INCLUDE_DIR
  • CsSignal_INCLUDE_DIR
  • CsString_INCLUDE_DIR

Compiling and Linking CsCore

The CMake build files have been designed to look for a system version of CsLibGuarded, CsSignal, and CsString when building CsCore. The following rules apply independently to each one of these system libraries.

Rules for which source files to use.

  • If a valid CMake search path is provided for CsLibGuarded, CsSignal, or CsString, the given system library will be used instead of the annex files
  • If CMake does not find a given system version, the source code in the annex directory will be used and the headers will be installed in the include directory

Rules for linking CsCore.

  • If a system version of the given library is found and the CMake variable CS_INSTALL_MODE is Package link with the system version and do not copy the headers to the install folder
  • If a system version of the given library is found and the CMake variable CS_INSTALL_MODE is Deploy link with the system version and copy the headers to the install folder
  • If no system path was specified or the given system library was not found, the files in src/annex will used instead of linking with the given system library

CopperSpice CMake

To build CsCore using one of the system libraries you will need to provide a search path to the CMake files located in the install prefix path for that library. You must also set the CMake variable CS_INSTALL_MODE to either Package or Deploy.

For example, after you build and install CsString the files will be located in the CMAKE_INSTALL_PREFIX which was specified in the build files for CsString. In the following CopperSpice CMake configuration script The install prefix for CsString is c/cs_string_lib.

# tells CMake where to search for the system libraries
export CMAKE_PREFIX_PATH="/c/cs_libguarded_lib/cmake/CsLibGuarded;\
/c/cs_signal_lib/cmake/CsSignal;/c/cs_string_lib/cmake/CsString"
cmake -G "Ninja" \
-DCS_INSTALL_MODE=Deploy \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/c/cs_lib /c/cs_source