Skip to content

fmorency/cmake-template_simple-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Motivation

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.

Description

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.

Usage

Build the library

In the project root directory, run the following commands to build the project:

$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ make

Add the library to your project

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)

About

Library for modular CMake template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages