From 564a8c92b59730b147ddc0898f538da49b84131c Mon Sep 17 00:00:00 2001
From: Syping <schiedelrafael@keppe.org>
Date: Thu, 9 Mar 2023 05:30:01 +0100
Subject: [PATCH] CMakeLists.txt: add C++17 build flags for MSVC

---
 CMakeLists.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 009b1a8..4706d44 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,12 +92,16 @@ else()
     set_target_properties(ragephoto PROPERTIES
         PREFIX "lib"
         VERSION "${ragephoto_VERSION}"
+        SOVERSION "${ragephoto_VERSION}"
     )
 endif()
 target_compile_definitions(ragephoto PRIVATE
     LIBRAGEPHOTO_LIBRARY
     ${LIBRAGEPHOTO_DEFINES}
 )
+if (MSVC)
+    target_compile_options(ragephoto PRIVATE "/Zc:__cplusplus")
+endif()
 target_include_directories(ragephoto PUBLIC
     "${ragephoto_BINARY_DIR}/include"
     "${ragephoto_SOURCE_DIR}/src"
@@ -157,6 +161,9 @@ if (RAGEPHOTO_EXTRACT)
     set_target_properties(ragephoto-extract PROPERTIES
         INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
     )
+    if (MSVC AND NOT RAGEPHOTO_C_API)
+        target_compile_options(ragephoto-extract PRIVATE "/Zc:__cplusplus")
+    endif()
     target_link_libraries(ragephoto-extract PRIVATE ragephoto)
     install(TARGETS ragephoto-extract DESTINATION "${CMAKE_INSTALL_BINDIR}")
 endif()