aboutsummaryrefslogtreecommitdiff
path: root/mwe/dynlink
diff options
context:
space:
mode:
authormax-001 <maxsmits21@knpmail.nl>2024-10-09 10:54:50 +0200
committermax-001 <maxsmits21@knpmail.nl>2024-10-09 10:54:50 +0200
commitf5b4e2c84326bd96c78ad1f6e4481c1970e54444 (patch)
treeaa75ef01ace01d86ffda93632e0b40dc11e0dcbc /mwe/dynlink
parent765550bce8a81c6f0c79c0083b14ef68e0c900b2 (diff)
parent6b7a670d60fec808e4fd1fcf3a8df2c503dcbdf4 (diff)
Merge remote-tracking branch 'origin/master' into max/POC-ECS-homemade
Diffstat (limited to 'mwe/dynlink')
-rw-r--r--mwe/dynlink/exec/CMakeLists.txt10
-rw-r--r--mwe/dynlink/exec/main.c2
-rw-r--r--mwe/dynlink/lib/CMakeLists.txt16
-rw-r--r--mwe/dynlink/lib/test.c (renamed from mwe/dynlink/lib/lib.c)0
-rw-r--r--mwe/dynlink/lib/test.h (renamed from mwe/dynlink/lib/lib.h)0
5 files changed, 25 insertions, 3 deletions
diff --git a/mwe/dynlink/exec/CMakeLists.txt b/mwe/dynlink/exec/CMakeLists.txt
index 5335f0f..465b45e 100644
--- a/mwe/dynlink/exec/CMakeLists.txt
+++ b/mwe/dynlink/exec/CMakeLists.txt
@@ -5,12 +5,20 @@ set(CMAKE_CXX_STANDARD 20)
project(main C CXX)
+add_executable(main main.c)
+
# Since we have the source code for the test library, we might as well let
# CMake use it so it automatically picks up the interface headers and compiles
# the library for us. The same can be achieved manually, but is more code.
add_subdirectory(../lib test)
-add_executable(main main.c)
+# include(ExternalProject)
+# ExternalProject_Add(test_ext
+# SOURCE_DIR ../../lib
+# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX="${CMAKE_BINARY_DIR}/ext"
+# )
+# add_dependencies(main test_ext)
+# find_package(test REQUIRED)
# Make sure ld.so (linux) looks in the same folder as the final executable for
# the .so dependency
diff --git a/mwe/dynlink/exec/main.c b/mwe/dynlink/exec/main.c
index 2bbdc20..ff884f2 100644
--- a/mwe/dynlink/exec/main.c
+++ b/mwe/dynlink/exec/main.c
@@ -1,4 +1,4 @@
-#include <lib.h>
+#include <test.h>
int main() {
library_function();
diff --git a/mwe/dynlink/lib/CMakeLists.txt b/mwe/dynlink/lib/CMakeLists.txt
index 2d15353..7efc91a 100644
--- a/mwe/dynlink/lib/CMakeLists.txt
+++ b/mwe/dynlink/lib/CMakeLists.txt
@@ -5,6 +5,20 @@ set(CMAKE_CXX_STANDARD 20)
project(lib C CXX)
-add_library(test SHARED lib.c)
+add_library(test SHARED)
+
target_include_directories(test SYSTEM INTERFACE .)
+target_sources(test PUBLIC
+ test.c
+)
+
+target_sources(test PUBLIC FILE_SET HEADERS FILES
+ test.h
+)
+
+install(
+ TARGETS test
+ FILE_SET HEADERS DESTINATION include
+)
+
diff --git a/mwe/dynlink/lib/lib.c b/mwe/dynlink/lib/test.c
index c7a78e4..c7a78e4 100644
--- a/mwe/dynlink/lib/lib.c
+++ b/mwe/dynlink/lib/test.c
diff --git a/mwe/dynlink/lib/lib.h b/mwe/dynlink/lib/test.h
index 093eadb..093eadb 100644
--- a/mwe/dynlink/lib/lib.h
+++ b/mwe/dynlink/lib/test.h