From 7847fc4bbaa6706bb5bfd2d5af91630ebeb39851 Mon Sep 17 00:00:00 2001 From: Evgeniy Meshcheryakov Date: Wed, 9 Oct 2024 11:27:43 +0300 Subject: [PATCH] Fix static linking --- launcher/CMakeLists.txt | 4 ++++ mapeditor/CMakeLists.txt | 4 ++++ vcmiqt/vcmiqt.h | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index e2229ba19..a56893838 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -202,6 +202,10 @@ elseif(NOT APPLE_IOS) target_link_libraries(vcmilauncher SDL2::SDL2) endif() +if(ENABLE_STATIC_LIBS OR NOT (ENABLE_EDITOR AND ENABLE_LAUNCHER)) + target_compile_definitions(vcmilauncher PRIVATE VCMIQT_STATIC) +endif() + target_link_libraries(vcmilauncher vcmi vcmiqt Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network) target_include_directories(vcmilauncher PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/mapeditor/CMakeLists.txt b/mapeditor/CMakeLists.txt index 33f6f6e67..e9f7ad6cf 100644 --- a/mapeditor/CMakeLists.txt +++ b/mapeditor/CMakeLists.txt @@ -217,6 +217,10 @@ if(APPLE) set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER vcmieditor) endif() +if(ENABLE_STATIC_LIBS OR NOT (ENABLE_EDITOR AND ENABLE_LAUNCHER)) + target_compile_definitions(vcmieditor PRIVATE VCMIQT_STATIC) +endif() + target_link_libraries(vcmieditor vcmi vcmiqt Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network) target_include_directories(vcmieditor PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/vcmiqt/vcmiqt.h b/vcmiqt/vcmiqt.h index a3cf5f8c0..4783eaaae 100644 --- a/vcmiqt/vcmiqt.h +++ b/vcmiqt/vcmiqt.h @@ -10,7 +10,7 @@ #include -#if VCMIQT_STATIC +#ifdef VCMIQT_STATIC # define VCMIQT_LINKAGE #elif defined(VCMIQT_SHARED) # define VCMIQT_LINKAGE Q_DECL_EXPORT