summaryrefslogtreecommitdiff
blob: a49181cee2319185e3cd591e7a23d82c9f803022 (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
respect DFHACK_LIBRARY_DESTINATION

From: eroen <dfhack@occam.eroen.eu>


---
 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 4c4d5568..aada996d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -187,11 +187,11 @@ set(DFHACK_BUILD_ID "" CACHE STRING "Build ID (should be specified on command li
 # 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 c2c80e79..36750bee 100644
--- a/plugins/ruby/CMakeLists.txt
+++ b/plugins/ruby/CMakeLists.txt
@@ -76,6 +76,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 240a67cb..4811aa2f 100644
--- a/plugins/ruby/ruby.cpp
+++ b/plugins/ruby/ruby.cpp
@@ -323,12 +323,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