From 95e54e4781062713de84d21482e8aed7b518af35 Mon Sep 17 00:00:00 2001
From: Tim Stahlhut <stahta01@gmail.com>
Date: Fri, 28 May 2021 20:13:24 -0400
Subject: cmake-mingw: Set better target names

Fixes an linking error caused by archive name conflict between
libcodelite and codelite targets.

---
 CodeLite/CMakeLists.txt   | 9 +++++++++
 LiteEditor/CMakeLists.txt | 7 +++++++
 2 files changed, 16 insertions(+)

diff --git a/CodeLite/CMakeLists.txt b/CodeLite/CMakeLists.txt
index fb8cfb72a..37b782263 100644
--- a/CodeLite/CMakeLists.txt
+++ b/CodeLite/CMakeLists.txt
@@ -135,6 +135,15 @@ else (UNIX AND NOT APPLE)
                           -lz)
 endif ( UNIX AND NOT APPLE )
 
+if(MINGW)
+    set_target_properties(libcodelite
+                          PROPERTIES
+                          PREFIX ""
+                          OUTPUT_NAME libcodelite
+                          RUNTIME_OUTPUT_NAME codelite
+                          ARCHIVE_OUTPUT_NAME codelite)
+endif()
+
 if (NOT MINGW)
     if(APPLE)
         install(TARGETS libcodelite DESTINATION ${CMAKE_BINARY_DIR}/codelite.app/Contents/MacOS/)
diff --git a/LiteEditor/CMakeLists.txt b/LiteEditor/CMakeLists.txt
index 4afccdf4d..30079114e 100644
--- a/LiteEditor/CMakeLists.txt
+++ b/LiteEditor/CMakeLists.txt
@@ -44,6 +44,13 @@ add_executable(codelite ${SRCS} ${RES_FILES})
 
 set( ADDITIONAL_LIBRARIES "" )
 
+if(MINGW)
+    set_target_properties(codelite
+                          PROPERTIES
+                          OUTPUT_NAME codelite
+                          ARCHIVE_OUTPUT_NAME execodelite)
+endif()
+
 if (UNIX)
     if ( IS_FREEBSD )
         set(ADDITIONAL_LIBRARIES "-lkvm")
-- 
