clean up in CMakeLists.txt

Also update SDL2 to 2.26.2 otherwise it will always rebuild in my pull request.
It's probably not a good idea to always update vcpkg.
This commit is contained in:
Roman Fomin 2023-01-09 19:39:50 +07:00
parent caa7299abb
commit e5872e9bda

View File

@ -145,6 +145,7 @@ endif()
if(WIN32) if(WIN32)
add_library(woof SHARED EXCLUDE_FROM_ALL ${WOOF_SOURCES}) add_library(woof SHARED EXCLUDE_FROM_ALL ${WOOF_SOURCES})
target_compile_definitions(woof PRIVATE WIN_LAUNCHER) target_compile_definitions(woof PRIVATE WIN_LAUNCHER)
# Some platforms have SDL2main, others don't. # Some platforms have SDL2main, others don't.
if(SDL2_MAIN_LIBRARY) if(SDL2_MAIN_LIBRARY)
list(APPEND WIN_LAUNCHER_LIBS SDL2::SDL2main) list(APPEND WIN_LAUNCHER_LIBS SDL2::SDL2main)
@ -154,40 +155,34 @@ if(WIN32)
# Stamp out and compile resource file on Windows. # Stamp out and compile resource file on Windows.
configure_file(resource.rc.in "${CMAKE_CURRENT_BINARY_DIR}/resource.rc") configure_file(resource.rc.in "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
add_executable(woof-com WIN32 add_executable(woof-com WIN32 ../win32/win_launcher.c
../win32/win_launcher.c "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
"${CMAKE_CURRENT_BINARY_DIR}/resource.rc"
)
target_woof_settings(woof-com) target_woof_settings(woof-com)
target_link_libraries(woof-com PRIVATE ${WIN_LAUNCHER_LIBS}) target_link_libraries(woof-com PRIVATE ${WIN_LAUNCHER_LIBS})
# MSVC tries to supply a default manifest and complains when it finds ours
# unless we specifically tell it not to.
if(MSVC) if(MSVC)
# MSVC tries to supply a default manifest and complains when it finds
# ours unless we specifically tell it not to.
target_link_options(woof-com PRIVATE "/MANIFEST:NO" "/SUBSYSTEM:CONSOLE") target_link_options(woof-com PRIVATE "/MANIFEST:NO" "/SUBSYSTEM:CONSOLE")
else() else()
target_link_options(woof-com PRIVATE "-mconsole") target_link_options(woof-com PRIVATE "-mconsole")
endif() endif()
add_executable(woof-exe WIN32 add_executable(woof-exe WIN32 ../win32/win_launcher.c
../win32/win_launcher.c "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
"${CMAKE_CURRENT_BINARY_DIR}/resource.rc"
)
target_woof_settings(woof-exe) target_woof_settings(woof-exe)
target_link_libraries(woof-exe PRIVATE ${WIN_LAUNCHER_LIBS}) target_link_libraries(woof-exe PRIVATE ${WIN_LAUNCHER_LIBS})
if(MSVC) if(MSVC)
target_link_options(woof-exe PRIVATE "/MANIFEST:NO") target_link_options(woof-exe PRIVATE "/MANIFEST:NO")
endif() endif()
set_target_properties(woof-exe PROPERTIES set_target_properties(woof-exe PROPERTIES RUNTIME_OUTPUT_NAME "woof"
RUNTIME_OUTPUT_NAME "woof" SUFFIX ".exe")
SUFFIX ".exe"
)
else() else()
# Some platforms have SDL2main, others don't.
if(SDL2_MAIN_LIBRARY) if(SDL2_MAIN_LIBRARY)
list(APPEND WOOF_LIBRARIES SDL2::SDL2main) list(APPEND WOOF_LIBRARIES SDL2::SDL2main)
endif() endif()
add_executable(woof ${WOOF_SOURCES}) add_executable(woof ${WOOF_SOURCES})
endif() endif()
target_woof_settings(woof) target_woof_settings(woof)
target_include_directories(woof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../") target_include_directories(woof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
@ -246,7 +241,7 @@ target_link_libraries(woof-setup PRIVATE ${SETUP_LIBRARIES}
SDL2::SDL2 SDL2_net::SDL2_net textscreen setup) SDL2::SDL2 SDL2_net::SDL2_net textscreen setup)
if(MSVC) if(MSVC)
set_target_properties(woof-setup PROPERTIES LINK_FLAGS "/MANIFEST:NO") target_link_options(woof-setup PRIVATE "/MANIFEST:NO" "/SUBSYSTEM:CONSOLE")
endif() endif()
# #