u01: Allow both static and dynamic linking

This uses CMake’s BUILD_SHARED_LIBS variable, which by default is set to
OFF. To build the shared library and link the binaries against it, you
can set it to ON.
This commit is contained in:
Simon Bruder 2023-04-22 14:27:08 +02:00
parent abb6291c56
commit fd230375ee

View file

@ -1,9 +1,7 @@
cmake_minimum_required(VERSION 3.20)
project(ecg_tree)
add_library(tree SHARED node.cpp)
# ~~~~~~
# This can be changed to STATIC to build and link a static library.
add_library(tree node.cpp)
add_executable(main main.cpp)
target_link_libraries(main tree)