Skip to content

Commit 8bde90e

Browse files
author
Oleh Kulykov
committed
1722245666
1 parent bd06c2f commit 8bde90e

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ source_group("CPP/7zip/Crypto"
10281028

10291029
if (LIBPLZMA_OPT_SHARED)
10301030
add_library(plzma SHARED ${LIBPLZMA_SOURCES} ${LIBPLZMA_PUBLIC_HEADERS} ${LIBPLZMA_INTERNAL_HEADERS})
1031-
set_property(TARGET plzma APPEND PROPERTY COMPILE_FLAGS -DLIBPLZMA_SHARED)
1031+
set_property(TARGET plzma APPEND PROPERTY COMPILE_FLAGS -DLIBPLZMA_SHARED=1)
10321032
if (MSVC)
10331033
message("Shared lib. MSVC")
10341034
# MSVC does not append 'lib' - do it here to have consistent name
@@ -1045,7 +1045,7 @@ endif()
10451045

10461046
if (LIBPLZMA_OPT_STATIC)
10471047
add_library(plzma_static STATIC ${LIBPLZMA_SOURCES} ${LIBPLZMA_PUBLIC_HEADERS} ${LIBPLZMA_INTERNAL_HEADERS})
1048-
set_property(TARGET plzma_static APPEND PROPERTY COMPILE_FLAGS -DLIBPLZMA_STATIC)
1048+
set_property(TARGET plzma_static APPEND PROPERTY COMPILE_FLAGS -DLIBPLZMA_STATIC=1)
10491049
if (MSVC)
10501050
# MSVC does not append 'lib' - do it here to have consistent name
10511051
set_target_properties(plzma_static PROPERTIES PREFIX "lib")

libplzma.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#define LIBPLZMA_VERSION_PATCH 4
5454

5555
// check windows
56-
#if defined(WIN32) || defined(_WIN32) || defined(WIN32_LEAN_AND_MEAN) || defined(_WIN64) || defined(WIN64)
56+
#if defined(WIN32) || defined(_WIN32) || defined(_WIN64) || defined(WIN64) || defined(WIN32_LEAN_AND_MEAN)
5757
# define LIBPLZMA_OS_WINDOWS 1
5858
#endif
5959

@@ -80,7 +80,18 @@
8080

8181
// if not using/building shared or static, then static
8282
#if !defined(LIBPLZMA_SHARED) && !defined(LIBPLZMA_STATIC)
83-
# define LIBPLZMA_STATIC
83+
# if defined(LIBPLZMA_OS_WINDOWS) && (defined(_MSC_VER) || defined(_MSC_FULL_VER))
84+
# if defined(_MT) && (_MT > 0)
85+
# if defined(_DLL)
86+
# define LIBPLZMA_SHARED 1
87+
# else
88+
# define LIBPLZMA_STATIC 1
89+
# endif // _DLL
90+
# endif // _MT
91+
# endif // LIBPLZMA_OS_WINDOWS && (_MSC_VER || _MSC_FULL_VER)
92+
# if !defined(LIBPLZMA_SHARED) && !defined(LIBPLZMA_STATIC)
93+
# define LIBPLZMA_STATIC 1
94+
# endif
8495
#endif
8596

8697
// dll api

src/plzma.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ const char * LIBPLZMA_NONNULL plzma_version(void) {
244244
#endif
245245

246246
#if defined(LIBPLZMA_MSC)
247+
// https://learn.microsoft.com/en-us/cpp/overview/compiler-versions
247248
# if defined(_MSC_FULL_VER)
248249
" : MSVC-" LIBPLZMA_TOSTRING(_MSC_FULL_VER)
249250
# elif defined(_MSC_VER)
@@ -256,12 +257,12 @@ const char * LIBPLZMA_NONNULL plzma_version(void) {
256257
# if defined(_DLL)
257258
// Causes the application to use the multithread-specific and DLL-specific version of the run-time library.
258259
// Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file.
259-
", multithreaded DLL"
260+
" : multithreaded DLL"
260261
# else
261262
// Causes the application to use the multithread, static version of the run-time library.
262263
// Defines _MT and causes the compiler to place the library name LIBCMT.lib into the .obj file
263264
// so that the linker will use LIBCMT.lib to resolve external symbols.
264-
", multithreaded"
265+
" : multithreaded"
265266
# endif // _DLL
266267
# endif // _MT && _MT > 0
267268
#endif

0 commit comments

Comments
 (0)