summaryrefslogtreecommitdiff
blob: 3163aa0a16e3613fb0c18ceb8bdf4073afc83fd1 (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
https://github.com/BYVoid/OpenCC/issues/322

--- /data/CMakeLists.txt
+++ /data/CMakeLists.txt
@@ -116,6 +116,19 @@
   )
 endforeach(DICT)
 
+add_custom_target(
+  copy_libopencc_to_dir_of_opencc_dict
+  COMMENT
+    "Copying libopencc to directory of opencc_dict"
+  COMMAND
+    ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:libopencc>" "$<TARGET_FILE_DIR:${OPENCC_DICT_BIN}>"
+)
+if (WIN32)
+  set(DICT_WIN32_DEPENDS copy_libopencc_to_dir_of_opencc_dict)
+else()
+  set(DICT_WIN32_DEPENDS)
+endif()
+
 foreach(DICT ${DICTS})
   add_custom_command(
     OUTPUT
@@ -123,14 +136,13 @@
     COMMENT
       "Building ${DICT}.ocd2"
     COMMAND
-      ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:libopencc>" "$<TARGET_FILE_DIR:${OPENCC_DICT_BIN}>"
-    COMMAND
       ${OPENCC_DICT_BIN}
         --input ${DICT_${DICT}_INPUT}
         --output ${DICT}.ocd2
         --from text
         --to ocd2
     DEPENDS
+      ${DICT_WIN32_DEPENDS}
       ${OPENCC_DICT_BIN}
       ${DICT_${DICT}_INPUT}
   )