Fix MSVC linking

This commit is contained in:
OPNA2608 2022-01-20 08:59:14 +01:00
parent 2c2ef754c2
commit c061b36720

View file

@ -181,11 +181,18 @@ if (WIN32)
list(APPEND ENGINE_SOURCES res/furnace.rc) list(APPEND ENGINE_SOURCES res/furnace.rc)
endif() endif()
set(USED_SOURCES ${ENGINE_SOURCES} ${AUDIO_SOURCES} src/main.cpp)
if (BUILD_GUI) if (BUILD_GUI)
add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} ${GUI_SOURCES} src/main.cpp) list(APPEND USED_SOURCES ${GUI_SOURCES})
if (MSVC)
add_executable(furnace WIN32 ${USED_SOURCES})
else()
add_executable(furnace ${USED_SOURCES})
endif()
target_compile_definitions(furnace PUBLIC HAVE_GUI) target_compile_definitions(furnace PUBLIC HAVE_GUI)
else() else()
add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} src/main.cpp) add_executable(furnace ${USED_SOURCES})
endif() endif()
if (DEVENDOR_LIBRARIES) if (DEVENDOR_LIBRARIES)
@ -200,7 +207,10 @@ if (HAVE_JACK)
endif() endif()
if (WIN32) if (WIN32)
target_link_libraries(furnace shlwapi -static) target_link_libraries(furnace shlwapi)
if (NOT MSVC)
target_link_libraries(furnace -static)
endif()
endif() endif()
install(TARGETS furnace RUNTIME DESTINATION bin) install(TARGETS furnace RUNTIME DESTINATION bin)