From fd230375ee01653063410d09fda66a1b7042f60b Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 22 Apr 2023 14:27:08 +0200 Subject: [PATCH] u01: Allow both static and dynamic linking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- u01/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/u01/CMakeLists.txt b/u01/CMakeLists.txt index 8851be7..012bd24 100644 --- a/u01/CMakeLists.txt +++ b/u01/CMakeLists.txt @@ -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)