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:
parent
abb6291c56
commit
fd230375ee
|
@ -1,9 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
project(ecg_tree)
|
project(ecg_tree)
|
||||||
|
|
||||||
add_library(tree SHARED node.cpp)
|
add_library(tree node.cpp)
|
||||||
# ~~~~~~
|
|
||||||
# This can be changed to STATIC to build and link a static library.
|
|
||||||
add_executable(main main.cpp)
|
add_executable(main main.cpp)
|
||||||
target_link_libraries(main tree)
|
target_link_libraries(main tree)
|
||||||
|
|
||||||
|
|
Reference in a new issue