Skip to content

Commit

Permalink
Move to a shared library by default with 7zip shared.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Jul 12, 2024
1 parent e36581f commit a22a61c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include(CMakePackageConfigHelpers)
project(archive)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
option(BUILD_STATIC "build static library" OFF)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)

add_subdirectory(src)

Expand Down
24 changes: 13 additions & 11 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,35 @@
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-windows-static-md"
},
"BUILD_SHARED_LIBS": {
"type": "BOOL",
"value": "OFF"
}
},
"generator": "Visual Studio 17 2022",
"inherits": ["cmake-dev", "vcpkg"],
"name": "vs2022-windows-shared",
"name": "vs2022-windows-static",
"toolset": "v143"
},
{
"cacheVariables": {
"BUILD_STATIC": {
"BUILD_SHARED_LIBS": {
"type": "BOOL",
"value": "ON"
},
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-windows"
}
},
"inherits": "vs2022-windows-shared",
"name": "vs2022-windows-static"
"inherits": "vs2022-windows-static",
"name": "vs2022-windows-shared"
},
{
"inherits": "vs2022-windows-static",
"inherits": "vs2022-windows-shared",
"name": "vs2022-windows"
}
],
"buildPresets": [
{
"name": "vs2022-windows",
"configurePreset": "vs2022-windows"
}
],
"version": 4
}
8 changes: 2 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ cmake_minimum_required(VERSION 3.16)

find_package(7zip CONFIG REQUIRED)

if (BUILD_STATIC)
add_library(archive STATIC)
else()
add_library(archive SHARED)
endif()
add_library(archive)

set_target_properties(archive PROPERTIES CXX_STANDARD 20)
target_link_libraries(archive PRIVATE 7zip::7zip)
Expand Down Expand Up @@ -44,7 +40,7 @@ if (MSVC)
target_compile_options(archive
PRIVATE
"/MP"
"/Wall"
"/W4"
"/external:anglebrackets"
"/external:W0"
)
Expand Down
2 changes: 1 addition & 1 deletion src/archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ HRESULT ArchiveImpl::loadFormats()
}

ArchiveImpl::ArchiveImpl()
: m_Valid(false), m_LastError(Error::ERROR_NONE), m_Library("dlls/7z"),
: m_Valid(false), m_LastError(Error::ERROR_NONE), m_Library("dlls/7zip.dll"),
m_PasswordCallback{}
{
// Reset the log callback:
Expand Down

0 comments on commit a22a61c

Please sign in to comment.