I recently moved on to try if SFML would work on Windows too
, and along the way I went to rewrite the CMakeLists.txt for my project.
I was following
this tutorial, slightly modifying it for my needs and everything went just as planned, it all works great with VS 2010, but I have one question.
The important part of my CMakeLists.txt:
find_package(SFML 2.0 REQUIRED system window graphics network audio)
if(SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
endif()
# Install
install(TARGETS ${EXECUTABLE_NAME} DESTINATION ${PROJECT_BINARY_DIR}/bin)
install(FILES ${SFML_LIBRARIES} DESTINATION ${PROJECT_BINARY_DIR}/bin)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/resources DESTINATION ${PROJECT_BINARY_DIR}/bin/resources)
As you can see I wanted to create a directory with the standalone program (executable, resources and the shared libraries) in the "install" target. But as you might also suspect, the
install(FILES ${SFML_LIBRARIES} DESTINATION ${PROJECT_BINARY_DIR}/bin)
copies the .lib files, not the .dll files, when used under Windows with VS. Is there a better way of doing it?
I know I could
a) install SFML to somewhere inside the PATH, like a normal person would
b) modify the PATH (at least before launching the executable)
c) do a windows if (if(CMAKE_HOST_WIN32)) and rework the ${SFML_LIBRARIES} and change lib -> bin and .lib -> .dll and install those files that way
...but I would like to have a universal, one-step solution that would work on any system (even if I can't install SFML to the system directories) without any needless tinkering with the paths and the makefile. Plus I guess having such a "ready to go" directory would be nice if at any time I wanted to make a simple installer
Am I missing something? How should I go about doing it?