When I run a simple "Hello World" program it finishes with exit code 0 without printing anything.
This is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.7)
project(TEST)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${TEST_SOURCE_DIR}/cmake")
set(CMAKE_C_STANDARD 99)
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
include_directories(${SDL2_INCLUDE_DIR}
${SDL2_IMAGE_INCLUDE_DIR})
set(SOURCE_FILES main.c)
add_executable(TEST ${SOURCE_FILES})
target_link_libraries(TEST ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARIES})
This is my program that doesn't print to console:
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
If I remove this line from my CMakeLists.txt file it does print but then I of course can't include SDL.
target_link_libraries(TEST ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARIES})
Any ideas?