CopperSpice Overview
|
Building a project using CMake requires at least one CMakeLists.txt
file in the root of your project. If your source files are located in a subdirectory it is common to use a separate CMake build file in the src subdirectory. This is the second file shown in the table below.
If there are additional subdirectories below the main source directory the CMake file is usually named after the folder. This is the third file shown in the table below.
Directory | File | Purpose |
---|---|---|
myApp | CMakeLists.txt | Modified per project, contains a list of source files and libraries |
myApp/src | CMakeLists.txt | Modified per project, contains a list of source files and libraries |
myApp/src/subfolder | subfolder.txt | Modified per project, contains a list of source files and libraries |
This is a fictitious project intended to show the syntax for building a CopperSpice project. For a full working program review the KitchenSink demo build files which is available on github and from our CopperSpice download page.
Using our sample HelloLunch project the contents of the root level CMakeLists.txt
is shown below.
The following CMakeLists.txt
is located in the src subdirectory along with your source files.
To configure, comile, link, and install HelloLunch
use the following commands. We suggest saving these to a bash script.
Parameter | Example | Information |
---|---|---|
-DCMAKE_PREFIX_PATH | /c/cs_lib/cmake/copperspice | typically a path to the CopperSpice CMake export files |
-DCMAKE_BUILD_TYPE | optional parameter, default is Release | |
-DCMAKE_INSTALL_PREFIX | /c/projects/HelloLunch/deploy | path where HelloLunch will be installed |
Last Parameter | [dot][dot] | path to HelloLunch project root directory |
Refer to the Building KitchenSink documentation which contains the suggested script to build and install the KitchenSink project.