From 8f686838be5578276f7dfd6685d0bf4fa6a09348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Isager=20Dalsgar=C3=B0?= Date: Fri, 16 Feb 2024 12:37:50 +0100 Subject: [PATCH] Use `link_bare_module()` for linking addons --- CMakeLists.txt | 83 ++++++++++++++++++++++++--------------------- test/CMakeLists.txt | 6 ---- vendor/libmem | 2 +- 3 files changed, 45 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb80d75..7f8d652 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,6 +163,11 @@ target_sources( include/bare/module.h include/bare/target.h include/bare/version.h + PUBLIC + $ + $ + $ + $ PRIVATE src/addon.c src/addon.h @@ -177,41 +182,33 @@ target_sources( target_include_directories( bare - PUBLIC - include + INTERFACE $ $ $ + PUBLIC + include ) -include_bare_module(bare-buffer bare_buffer) -include_bare_module(bare-hrtime bare_hrtime) -include_bare_module(bare-inspect bare_inspect) -include_bare_module(bare-module bare_module) -include_bare_module(bare-os bare_os) -include_bare_module(bare-timers bare_timers) -include_bare_module(bare-url bare_url) - -list(APPEND objects - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ +target_link_libraries( + bare + INTERFACE + $ + PUBLIC + napi + mem + utf ) -add_library(bare_shared SHARED ${objects}) +link_bare_module(bare bare-buffer) +link_bare_module(bare bare-hrtime) +link_bare_module(bare bare-inspect) +link_bare_module(bare bare-module) +link_bare_module(bare bare-os) +link_bare_module(bare bare-timers) +link_bare_module(bare bare-url) + +add_library(bare_shared SHARED) set_target_properties( bare_shared @@ -231,15 +228,21 @@ if(target MATCHES "win32") ) endif() +target_include_directories( + bare_shared + INTERFACE + $ +) + target_link_libraries( bare_shared PUBLIC $ PRIVATE - $ + bare ) -add_library(bare_static STATIC ${objects}) +add_library(bare_static STATIC) set_target_properties( bare_static @@ -248,12 +251,18 @@ set_target_properties( PREFIX lib ) +target_include_directories( + bare_static + INTERFACE + $ +) + target_link_libraries( bare_static PUBLIC $ PRIVATE - $ + bare ) if(target MATCHES "win32") @@ -274,17 +283,9 @@ add_bare_bundle( bin/bundle.config.js ) -include_bare_module(bare-pipe bare_pipe) -include_bare_module(bare-repl bare_repl) -include_bare_module(bare-tty bare_tty) - add_executable(bare_bin bin/bare.c bin/bare.bundle.h - - $ - $ - $ ) set_target_properties( @@ -312,6 +313,10 @@ target_link_libraries( $ ) +link_bare_module(bare_bin bare-pipe) +link_bare_module(bare_bin bare-repl) +link_bare_module(bare_bin bare-tty) + install( TARGETS bare_bin ARCHIVE DESTINATION lib diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 95139a1..0ab9a9c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -55,12 +55,6 @@ foreach(file IN LISTS tests) $ ) - target_include_directories( - ${test} - PRIVATE - $ - ) - set(command ${test}) endif() diff --git a/vendor/libmem b/vendor/libmem index 6199b60..6a95636 160000 --- a/vendor/libmem +++ b/vendor/libmem @@ -1 +1 @@ -Subproject commit 6199b6014d7c3c4beee54e90e13d16273e1ec98b +Subproject commit 6a95636301f8b15605f8b6465b814e39c4f62541