From da0321549dbc2865b0960e7e96b5750d8275ee13 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Mon, 5 Dec 2022 15:03:31 +0100 Subject: [PATCH] Explicitly set LD_LIBRARY_PATH (or PATH, if running on Windows) when invoking the test programs. --- config.mk | 6 ++++++ test/hash-map/Makefile | 2 +- test/hash-set/Makefile | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config.mk b/config.mk index 69a815c..6ba0250 100644 --- a/config.mk +++ b/config.mk @@ -44,3 +44,9 @@ ifneq ($(STRIP),) XLDFLAGS += -Wl,--strip-all DLL_LDFLAGS += -Wl,--strip-all endif + +ifneq ($(firstword $(filter MINGW32_NT-% MINGW64_NT-% CYGWIN_NT-%,$(shell uname))),) + ENV_LDPATH := PATH +else + ENV_LDPATH := LD_LIBRARY_PATH +endif diff --git a/test/hash-map/Makefile b/test/hash-map/Makefile index 7d35e51..872e8d1 100644 --- a/test/hash-map/Makefile +++ b/test/hash-map/Makefile @@ -21,7 +21,7 @@ $(ALL_PATH): mkdir -p $@ test: all - ./$(BIN_FILE) + env $(ENV_LDPATH)="$(realpath .):$(realpath ../../libhashset/lib)$(if $($(ENV_LDPATH)),:$($(ENV_LDPATH)))" ./$(BIN_FILE) clean: rm -vf $(BIN_FILE) diff --git a/test/hash-set/Makefile b/test/hash-set/Makefile index 33ddf34..5f85946 100644 --- a/test/hash-set/Makefile +++ b/test/hash-set/Makefile @@ -21,7 +21,7 @@ $(ALL_PATH): mkdir -p $@ test: all - ./$(BIN_FILE) + env $(ENV_LDPATH)="$(realpath .):$(realpath ../../libhashset/lib)$(if $($(ENV_LDPATH)),:$($(ENV_LDPATH)))" ./$(BIN_FILE) clean: rm -vf $(BIN_FILE)