summaryrefslogtreecommitdiff
blob: 7c0b2b2ac666d06cb45b2d6a7bce374534a529a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 9f367aaa1381476871b72d08c4fb62995556337a Mon Sep 17 00:00:00 2001
From: eroen <eroen@occam.eroen.eu>
Date: Tue, 7 Mar 2017 22:43:57 +0100
Subject: [PATCH 4/5] respect DFHACK_LIBRARY_DESTINATION

---
 CMakeLists.txt              | 4 ++--
 plugins/ruby/CMakeLists.txt | 2 ++
 plugins/ruby/ruby.cpp       | 6 +++---
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e8d30ce..40b17434 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -146,11 +146,11 @@ set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")
 # the dfhack libraries will be installed here:
 IF(UNIX)
     # put the lib into DF/hack
-    SET(DFHACK_LIBRARY_DESTINATION hack)
+    SET(DFHACK_LIBRARY_DESTINATION hack CACHE INTERNAL "")
     SET(DFHACK_EGGY_DESTINATION libs)
 ELSE()
     # windows is crap, therefore we can't do nice things with it. leave the libs on a nasty pile...
-    SET(DFHACK_LIBRARY_DESTINATION .)
+    SET(DFHACK_LIBRARY_DESTINATION . CACHE INTERNAL "")
     SET(DFHACK_EGGY_DESTINATION .)
 ENDIF()
 # external tools will be installed here:
diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt
index 6b5e62c6..d75e9f1e 100644
--- a/plugins/ruby/CMakeLists.txt
+++ b/plugins/ruby/CMakeLists.txt
@@ -69,6 +69,8 @@ INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread")
 
 DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread)
 ADD_DEPENDENCIES(ruby ruby-autogen-rb)
+set_property( SOURCE "ruby.cpp" APPEND PROPERTY COMPILE_DEFINITIONS
+        "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" )
 
 IF(EXISTS ${RUBYLIB})
     INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION} RENAME ${RUBYLIB_INSTALL_NAME})
diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp
index ed38868b..cd2dcb1f 100644
--- a/plugins/ruby/ruby.cpp
+++ b/plugins/ruby/ruby.cpp
@@ -320,12 +320,12 @@ static int df_loadruby(void)
 {
     const char *libpaths[] = {
 #if defined(WIN32)
-        "./libruby.dll",
+        DFHACK_LIBRARY_DESTINATION "./libruby.dll",
 #elif defined(__APPLE__)
-        "hack/libruby.dylib",
+        DFHACK_LIBRARY_DESTINATION "/libruby.dylib",
         "/System/Library/Frameworks/Ruby.framework/Ruby",
 #else
-        "hack/libruby.so",
+        DFHACK_LIBRARY_DESTINATION "hack/libruby.so",
         "libruby.so",
 #endif
         NULL
-- 
2.11.1