Improve the cmake documentation

This commit is contained in:
Tilen Majerle 2023-12-09 16:49:22 +01:00
parent 181c2c7dd9
commit 7aeab7a56e
2 changed files with 23 additions and 5 deletions

View File

@ -58,7 +58,17 @@ Add library to project
^^^^^^^^^^^^^^^^^^^^^^
At this point it is assumed that you have successfully download library, either cloned it or from releases page.
Next step is to add the library to the project, by means of source files to compiler inputs and header files in search path
Next step is to add the library to the project, by means of source files to compiler inputs and header files in search path.
*CMake* is the main supported build system. Package comes with the ``CMakeLists.txt`` and ``library.cmake`` files, both located in the ``lwmem`` directory:
* ``CMakeLists.txt``: Is a wrapper and only includes ``library.cmake`` file. It is used if target application uses ``add_subdirectory`` and then uses ``target_link_libraries`` to include the library in the project
* ``library.cmake``: It is a fully configured set of variables. User must use ``include(path/to/library.cmake)`` to include the library and must manually add files/includes to the final target
.. tip::
Open ``library.cmake`` file and manually analyze all the possible variables you can set for full functionality.
If you do not use the *CMake*, you can do the following:
* Copy ``lwmem`` folder to your project, it contains library files
* Add ``lwmem/src/include`` folder to `include path` of your toolchain. This is where `C/C++` compiler can find the files during compilation process. Usually using ``-I`` flag
@ -66,10 +76,6 @@ Next step is to add the library to the project, by means of source files to comp
* Copy ``lwmem/src/include/lwmem/lwmem_opts_template.h`` to project folder and rename it to ``lwmem_opts.h``
* Build the project
.. tip::
If you are using *CMake* build system, you can add the library to the project by adding the *library's folder*
directory with ``add_directory()`` CMake command, followed by linking the target with ``target_link_libraries()``
Configuration file
^^^^^^^^^^^^^^^^^^

View File

@ -1,3 +1,15 @@
#
# This file provides set of variables for end user
# and also generates one (or more) libraries, that can be added to the project using target_link_libraries(...)
#
# Before this file is included to the root CMakeLists file (using include() function), user can set some variables:
#
# LWMEM_SYS_PORT: If defined, it will include port source file from the library.
# LWMEM_OPTS_DIR: If defined, it should set the folder path where options file shall be generated.
# LWMEM_COMPILE_OPTIONS: If defined, it provide compiler options for generated library.
# LWMEM_COMPILE_DEFINITIONS: If defined, it provides "-D" definitions to the library build
#
# Library core sources
set(lwmem_core_SRCS
${CMAKE_CURRENT_LIST_DIR}/src/lwmem/lwmem.c