From bfa8bb4042a48991a3faf17f3c3afc0317d4a9b5 Mon Sep 17 00:00:00 2001 From: VisualGMQ <2142587070@qq.com> Date: Sun, 25 Jun 2023 13:46:08 +0800 Subject: [PATCH] (add): add cmake install --- CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfa0864..fb419d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,9 +10,23 @@ include(cmake/utility.cmake) include(cmake/FindSDL2.cmake) include(cmake/copydll.cmake) +IsMSVCBackend(is_msvc_backend) + aux_source_directory(src SRC) add_executable(mine-sweep ${SRC}) target_include_directories(mine-sweep PRIVATE include) target_link_libraries(mine-sweep PRIVATE SDL2) target_compile_features(mine-sweep PRIVATE cxx_std_17) -CopyDLL(mine-sweep) \ No newline at end of file + +if (${is_msvc_backend}) + target_link_options(mine-sweep PRIVATE $,/SUBSYSTEM:WINDOWS,/SUBSYSTEM:CONSOLE>) +endif() + +CopyDLL(mine-sweep) + +install(PROGRAMS $ +DESTINATION "${CMAKE_BINARY_DIR}/mine-sweep-${PROJECT_VERSION}") +install(DIRECTORY resources +DESTINATION "${CMAKE_BINARY_DIR}/mine-sweep-${PROJECT_VERSION}") +install(FILES $CACHE{SDL2_DYNAMIC_LIB_DIR}/SDL2.dll +DESTINATION "${CMAKE_BINARY_DIR}/mine-sweep-${PROJECT_VERSION}") \ No newline at end of file