diff options
author | Robin Krahl <me@robin-krahl.de> | 2017-03-27 22:56:28 +0200 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2017-03-27 22:56:28 +0200 |
commit | bdaf2194e083f691e468a560fd5934576dbb8221 (patch) | |
tree | 2396caa5e0e58c4590a66ac7e632ec1988893958 /Makefile | |
parent | a2ba7a6cbcd6ae22052b2b4d92a97dac208a309c (diff) | |
download | sqlitepp-bdaf2194e083f691e468a560fd5934576dbb8221.tar.gz sqlitepp-bdaf2194e083f691e468a560fd5934576dbb8221.tar.bz2 |
Makefile: Set the library directory when compiling sqlitepp_test
Using the rpath linker option makes it possible to call sqlitepp_test
directly without setting LD_LIBRARY_PATH.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -10,7 +10,8 @@ DOCUMENTATION_DIR := doc SOURCE_NAMES_LIB := sqlitepp.cpp SOURCE_NAMES_TEST := sqlitepp_test.cpp -TARGET_LIB := $(LIBRARY_DIR)/libsqlitepp.so +TARGET_NAME_LIB := sqlitepp +TARGET_LIB := $(LIBRARY_DIR)/lib$(TARGET_NAME_LIB).so SOURCES_LIB := $(foreach source,$(SOURCE_NAMES_LIB),$(SOURCE_DIR)/$(source)) OBJECTS_LIB := $(SOURCES_LIB:$(SOURCE_DIR)/%.cpp=$(OBJECT_DIR)/%.o) DEPENDS_LIB := $(OBJECTS_LIB:.o=.d) @@ -28,7 +29,7 @@ DEPENDS := $(DEPENDS_LIB) $(DEPENDS_TEST) CPPFLAGS += -MMD -MP -I$(INCLUDE_DIR) CXXFLAGS += -fPIC LDFLAGS += $(LDFLAGS_SQLITE3) -LDFLAGS_TEST += -L$(LIBRARY_DIR) -lsqlitepp $(LDFLAGS_GTEST) +LDFLAGS_TEST += -L$(LIBRARY_DIR) -l$(TARGET_NAME_LIB) $(LDFLAGS_GTEST) -Wl,-rpath,$(LIBRARY_DIR) ifdef VERBOSE QUIET := @@ -54,10 +55,10 @@ doc: $(INCLUDES) doxygen memcheck: $(TARGET_TEST) - LD_LIBRARY_PATH=$(LIBRARY_DIR) valgrind --tool=memcheck ./$(TARGET_TEST) + valgrind --tool=memcheck ./$(TARGET_TEST) test: $(TARGET_TEST) - LD_LIBRARY_PATH=$(LIBRARY_DIR) ./$(TARGET_TEST) + ./$(TARGET_TEST) $(TARGET_LIB): $(OBJECTS_LIB) $(info (CXX) $@) |