Skip to content

Commit d955efc

Browse files
ChrisThrashereXpl0it3r
authored andcommitted
Copy DLLs to the same directory as the executable that needs them
1 parent 02f0774 commit d955efc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.15)
1+
cmake_minimum_required(VERSION 3.21)
22
project(CMakeSFMLProject LANGUAGES CXX)
33

44
include(FetchContent)
@@ -10,5 +10,9 @@ FetchContent_MakeAvailable(SFML)
1010
add_executable(CMakeSFMLProject src/main.cpp)
1111
target_link_libraries(CMakeSFMLProject PRIVATE sfml-graphics)
1212
target_compile_features(CMakeSFMLProject PRIVATE cxx_std_17)
13+
if (WIN32 AND BUILD_SHARED_LIBS)
14+
add_custom_command(TARGET CMakeSFMLProject POST_BUILD
15+
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:CMakeSFMLProject> $<TARGET_FILE_DIR:CMakeSFMLProject> COMMAND_EXPAND_LISTS)
16+
endif()
1317

1418
install(TARGETS CMakeSFMLProject)

0 commit comments

Comments
 (0)