Remove the WINDOWS CMake option, and just detect Windows instead

Also remove the STATIC option from MSVC because why wouldn't you
This commit is contained in:
Clownacy 2019-04-13 21:25:46 +01:00
parent bde0c979ff
commit 4d9bc0a65f

View file

@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.12)
option(STATIC "Produce a statically-linked executable (good for Windows builds, so you don't need to bundle DLL files)" OFF) option(STATIC "Produce a statically-linked executable (good for Windows builds, so you don't need to bundle DLL files)" OFF)
option(JAPANESE "Enable the Japanese-language build" OFF) option(JAPANESE "Enable the Japanese-language build" OFF)
option(FIX_BUGS "Fix certain bugs (see src/Bug Fixes.txt)" OFF) option(FIX_BUGS "Fix certain bugs (see src/Bug Fixes.txt)" OFF)
option(WINDOWS "Enable Windows-only features like a unique file/taskbar icon, and system font loading (needed for the font setting in Config.dat to do anything)" OFF)
option(RASPBERRY_PI "Enable tweaks to improve performance on Raspberry Pis" OFF) option(RASPBERRY_PI "Enable tweaks to improve performance on Raspberry Pis" OFF)
option(NONPORTABLE "Enable bits of code that aren't portable, but are what the original game used" OFF) option(NONPORTABLE "Enable bits of code that aren't portable, but are what the original game used" OFF)
@ -231,13 +230,6 @@ if (FIX_BUGS)
target_compile_definitions(CSE2 PRIVATE FIX_BUGS) target_compile_definitions(CSE2 PRIVATE FIX_BUGS)
endif() endif()
if (WINDOWS)
target_sources(CSE2 PRIVATE "res/ICON/ICON.rc")
target_compile_definitions(CSE2 PRIVATE WINDOWS)
else()
list(APPEND RESOURCES "ICON/ICON_MINI.bmp")
endif()
if (RASPBERRY_PI) if (RASPBERRY_PI)
target_compile_definitions(CSE2 PRIVATE RASPBERRY_PI) target_compile_definitions(CSE2 PRIVATE RASPBERRY_PI)
endif() endif()
@ -246,6 +238,15 @@ if (NONPORTABLE)
target_compile_definitions(CSE2 PRIVATE NONPORTABLE) target_compile_definitions(CSE2 PRIVATE NONPORTABLE)
endif() endif()
# Make some tweaks if we're targetting Windows
if (WIN32)
target_sources(CSE2 PRIVATE "res/ICON/ICON.rc")
target_compile_definitions(CSE2 PRIVATE WINDOWS)
set_target_properties(CSE2 PROPERTIES WIN32_EXECUTABLE YES) # Disable the console window
else()
list(APPEND RESOURCES "ICON/ICON_MINI.bmp")
endif()
# Magic to convert resources to header files # Magic to convert resources to header files
add_executable(bin2h res/bin2h.c) add_executable(bin2h res/bin2h.c)
foreach(FILENAME IN LISTS RESOURCES) foreach(FILENAME IN LISTS RESOURCES)
@ -270,10 +271,6 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
endif() endif()
endif() endif()
if (WIN32)
set_target_properties(CSE2 PROPERTIES WIN32_EXECUTABLE YES) # Disable the console window
endif()
if (MSVC) if (MSVC)
if (STATIC) if (STATIC)
message(STATUS "STATIC option doesn't affect MSVC builds") message(STATUS "STATIC option doesn't affect MSVC builds")