This project is part of a serie of CMake template designed to teach, simplify
and encourage the use of the CMake build system.
The template is designed to by easily used with Git repositories. Libraries are
designed to be used as Git submodules. The template is also designed to avoid
nested dependencies between submodules.
This module builds a small dummy C++ library. The library build system modular
design allows the library to be build standalone or within an application.
In the project root directory, run the following commands to build the project:
$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ make
To add this library to your application, first add
set(simple-library_DIR /path/to/the/library)
near the top of your application CMakelists.txt file. You can then call
find_package(simple-library REQUIRED)
to configure the library. You can then add the line
include_directories(${simple-library_include_dir})
to add the library headers to your project include directories. After your
add_executable()
line, you can add
add_dependencies(${PROJECT_NAME} simple-library)
target_link_libraries(${PROJECT_NAME} simple-library)