forked from HarbourMasters/2ship2harkinian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy-existing-otrs.cmake
30 lines (27 loc) · 1.25 KB
/
copy-existing-otrs.cmake
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
message(STATUS "Copying otr files...")
# Copy and rename mm.zip to mm.o2r
if(NOT ONLY2SHIPOTR AND EXISTS ${SOURCE_DIR}/OTRExporter/mm.zip)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy mm.zip ${SOURCE_DIR}/mm.o2r)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy mm.zip ${BINARY_DIR}/mm/mm.o2r)
message(STATUS "Copied mm.zip")
endif()
if(EXISTS ${SOURCE_DIR}/OTRExporter/2ship.o2r)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy 2ship.o2r ${SOURCE_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy 2ship.o2r ${BINARY_DIR}/mm/)
message(STATUS "Copied 2ship.o2r")
endif()
# Additionally for Windows, copy the otrs to the target dir, side by side with 2ship.exe
if(SYSTEM_NAME MATCHES "Windows")
if(NOT ONLY2SHIPOTR AND EXISTS ${SOURCE_DIR}/OTRExporter/mm.zip)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy mm.zip ${TARGET_DIR}/mm.o2r)
endif()
if(EXISTS ${SOURCE_DIR}/OTRExporter/o2r)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy 2ship.o2r ${TARGET_DIR})
endif()
endif()
if(NOT ONLY2SHIPOTR AND (NOT EXISTS ${SOURCE_DIR}/mm.o2r))
message(FATAL_ERROR "Failed to copy. No O2R files found.")
endif()
if(NOT EXISTS ${SOURCE_DIR}/2ship.o2r)
message(FATAL_ERROR "Failed to copy. No 2ship O2R found.")
endif()