Hey there!
I'm trying to setup an SFML helloworld in CLion using CMake in Windows with MinGW, here's what I do:
The main.cpp is the standard
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
Here's what my CMakeLists.txt looks like:
#Change this if you need to target a specific CMake version
cmake_minimum_required(VERSION 2.6)
set(PROJECT_NAME "MuspelheimR")
project(MuspelheimR)
# Enable debug symbols by default
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE Debug)
endif()
# (you can also set it on the command line: -D CMAKE_BUILD_TYPE=Release)
# Set version information in a config.h file
set(MuspelheimR_VERSION_MAJOR 1)
set(MuspelheimR_VERSION_MINOR 0)
configure_file(
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)
include_directories("${PROJECT_BINARY_DIR}")
# Define sources and executable
set(EXECUTABLE_NAME ${PROJECT_NAME})
add_executable(${EXECUTABLE_NAME} main.cpp)
# Detect and add SFML
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
#Find any version 2.X of SFML
#See the FindSFML.cmake file for additional details and instructions
set(SEFML_ROOT "C:\\SFML-2.2")
find_package(SFML 2 REQUIRED system window graphics network audio)
if(SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
endif()
# Install target
install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin)
# CPack packaging
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_VERSION_MAJOR "${MuspelheimR_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${MuspelheimR_VERSION_MINOR}")
include(CPack)
The build is just fine, but when I launch the executable I get
"Process finished with exit code -1073741515 (0xC0000135)"
If I try to launch it manually the popup window says:
The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Try reinstalling the program to fix this problem.
What's wrong?