ref: 2c8ccc5a0b551c8cd4afd38d51469573702a4ef0
parent: 5ec9fea302a39d6212584fd255a770e5a4be559e
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sun Apr 14 00:14:45 EDT 2019
Actually, only generate the output folder during cmake's config stage
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -339,10 +339,18 @@
target_link_libraries(CSE2 ${SDL2_LIBRARIES} ${FREETYPE_LIBRARIES})
# Set up the output directory
-add_custom_command(TARGET CSE2 PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/cavestory")
+# Copy the files to the output directory
+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/${FILES_DIR}/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/cavestory")
+
+# Send the Release executable to the directory
set_target_properties(CSE2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}/cavestory")
-add_custom_command(TARGET CSE2 POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/${FILES_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/cavestory")
+# On MSVC, copy across SDL2.dll as well
+if (MSVC)
+ if (CMAKE_CL_64)
+ file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/msvc/SDL2/lib/x64/SDL2.dll" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/cavestory")
+ else()
+ file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/msvc/SDL2/lib/x86/SDL2.dll" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/cavestory")
+ endif()
+endif()