diff --git a/CMakeLists.txt b/CMakeLists.txt index ff51c21..6c9c666 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,16 @@ project(8ChocChip LANGUAGES CXX VERSION 0.1) -add_subdirectory(dependencies) -add_subdirectory(src) +#file(COPY assets DESTINATION ${CMAKE_BINARY_DIR}) +# +#install(DIRECTORY assets DESTINATION ${CMAKE_INSTALL_PREFIX}) + +file(GLOB ASSETS "${CMAKE_SOURCE_DIR}/assets/*") -file(COPY assets DESTINATION ${CMAKE_BINARY_DIR}) +# Copy assets to build directory +foreach(ASSET ${ASSETS}) + configure_file(${ASSET} ${CMAKE_BINARY_DIR}/assets COPYONLY) +endforeach() -install(DIRECTORY assets DESTINATION ${CMAKE_INSTALL_PREFIX}) \ No newline at end of file +add_subdirectory(dependencies) +add_subdirectory(src) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e9102f5..5ef785f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,6 +14,11 @@ endif() target_link_libraries(8ChocChip PRIVATE sfml-graphics sfml-audio sfml-window sfml-system nativefiledialog ${libname}++) +# Set the RPATH of the executable to include the directory where SFML libraries are located +set_target_properties(8ChocChip PROPERTIES + INSTALL_RPATH "$ORIGIN" +) + # Copy DLLs needed for runtime on Windows if(WIN32) if (BUILD_SHARED_LIBS)