# jpeg: Create libjpeg-9.dll when using mingw

**URL:** <https://discourse.libsdl.org/t/jpeg-create-libjpeg-9-dll-when-using-mingw/36089>\
**Category:** SDL Commits\
**Created:** [May 10, 2022, 4:44pm UTC](https://discourse.libsdl.org/t/jpeg-create-libjpeg-9-dll-when-using-mingw/36089 "2022-05-10T16:44:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [May 10, 2022, 4:44pm UTC](https://discourse.libsdl.org/t/jpeg-create-libjpeg-9-dll-when-using-mingw/36089/1 "2022-05-10T16:44:01Z")

</div>

> <https://github.com/libsdl-org/jpeg/commit/143e9e0cfdd4b2c24a2e9ffcf4bde4e8241246aa>

```diff
From 143e9e0cfdd4b2c24a2e9ffcf4bde4e8241246aa Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Tue, 10 May 2022 07:54:30 +0200
Subject: [PATCH] Create libjpeg-9.dll when using mingw

---
 CMakeLists.txt | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a88a280..9107fd0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,6 +50,14 @@ target_include_directories(jpeg PUBLIC
 set_target_properties(jpeg PROPERTIES
 	SOVERSION "${PROJECT_VERSION_MAJOR}"
 	VERSION "${PROJECT_VERSION}"
-	PUBLIC_HEADER "${jpeg_headers}")
+	PUBLIC_HEADER "${jpeg_headers}"
+	# create libjpeg-9.dll on Windows
+	RUNTIME_OUTPUT_NAME "jpeg-${PROJECT_VERSION_MAJOR}"
+	PREFIX lib)
+
+if(MINGW AND BUILD_SHARED_LIBS)
+	set_target_properties(jpeg PROPERTIES
+ PREFIX lib)
+endif()
 
 install(TARGETS jpeg)

```
