cmake_minimum_required(VERSION 3.10) project(WEP C) find_package(SDL2 REQUIRED) add_subdirectory(cards) include_directories(cards) if(NOT MSVC) add_compile_options(-Wall -Wextra -pedantic) endif() add_executable(sol sol.c) add_executable(freecell freecell.c) # Workaround possible bugs in SDL2Config.cmake if(MINGW) target_link_libraries(sol mingw32) # -lmingw32 -lSDL2main -lSDL2 in that order. target_link_libraries(freecell mingw32) set_target_properties(sol PROPERTIES WIN32_EXECUTABLE 1) # -mwindows set_target_properties(freecell PROPERTIES WIN32_EXECUTABLE 1) endif() target_link_libraries(sol cards SDL2::SDL2main SDL2::SDL2) target_link_libraries(freecell cards SDL2::SDL2main SDL2::SDL2) # Avoid conflicting with SOL.EXE, FREECELL.EXE on Windows if(WIN32) set_target_properties(sol PROPERTIES OUTPUT_NAME wepsol) set_target_properties(freecell PROPERTIES OUTPUT_NAME wepfreecell) endif() install(TARGETS sol freecell)