From c061b367203243da566d5e27c1fea1e883f6bf09 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 20 Jan 2022 08:59:14 +0100 Subject: [PATCH] Fix MSVC linking --- CMakeLists.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9382c624e..162618ebe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,11 +181,18 @@ if (WIN32) list(APPEND ENGINE_SOURCES res/furnace.rc) endif() +set(USED_SOURCES ${ENGINE_SOURCES} ${AUDIO_SOURCES} src/main.cpp) + 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) else() - add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} src/main.cpp) + add_executable(furnace ${USED_SOURCES}) endif() if (DEVENDOR_LIBRARIES) @@ -200,7 +207,10 @@ if (HAVE_JACK) endif() if (WIN32) - target_link_libraries(furnace shlwapi -static) + target_link_libraries(furnace shlwapi) + if (NOT MSVC) + target_link_libraries(furnace -static) + endif() endif() install(TARGETS furnace RUNTIME DESTINATION bin)