Skip to content

Commit 2f43ca4

Browse files
committed
Fix broken build when using system zxcvbn (#10717)
* Fix broken build when using system zxcvbn Fixup of zxcvbn include statement added in 5513ff5. A zxcvbn/ directory prefix breaks building with system zxcvbn. Remove this prefix to align this include statement with ones present in other files. Add zxcvbn libraries as dependency to CliTest. * Move src/zxcvbn/ to src/thirdparty/zxcvbn
1 parent 95b91a0 commit 2f43ca4

File tree

12 files changed

+39
-20
lines changed

12 files changed

+39
-20
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ if(WITH_COVERAGE)
467467
append_coverage_compiler_flags()
468468

469469
set(COVERAGE_EXCLUDES
470-
"'^(.+/)?(thirdparty|zxcvbn)/.*'"
470+
"'^(.+/)?thirdparty/.*'"
471471
"'^(.+/)?main\\.cpp$$'"
472472
"'^(.+/)?cli/keepassxc-cli\\.cpp$$'"
473473
"'^(.+/)?proxy/keepassxc-proxy\\.cpp$$'")
@@ -613,6 +613,12 @@ endif()
613613

614614
include_directories(SYSTEM ${ZLIB_INCLUDE_DIR})
615615

616+
find_library(ZXCVBN_LIBRARIES zxcvbn)
617+
if(NOT ZXCVBN_LIBRARIES)
618+
add_subdirectory(src/thirdparty/zxcvbn)
619+
set(ZXCVBN_LIBRARIES zxcvbn)
620+
endif(NOT ZXCVBN_LIBRARIES)
621+
616622
add_subdirectory(src)
617623
add_subdirectory(share)
618624
if(WITH_TESTS)

COPYING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Files: src/streams/qtiocompressor.*
249249
Copyright: 2009-2012, Nokia Corporation and/or its subsidiary(-ies)
250250
License: LGPL-2.1 or GPL-3
251251

252-
Files: src/zxcvbn/zxcvbn.*
252+
Files: src/thirdparty/zxcvbn/zxcvbn.*
253253
Copyright: 2015-2017, Tony Evans
254254
License: MIT
255255

cmake/CLangFormat.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
set(EXCLUDED_DIRS
1717
# third-party directories
1818
src/thirdparty
19-
src/zxcvbn
2019
# objective-c directories
2120
src/touchid
2221
src/autotype/mac

codecov.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
1+
codecov:
2+
require_ci_to_pass: false
13
coverage:
24
range: 60..80
35
round: nearest
46
precision: 2
7+
status:
8+
project:
9+
default:
10+
target: auto
11+
threshold: 0.5%
12+
paths:
13+
- "src"
14+
patch:
15+
default:
16+
target: 50%
17+
threshold: 0%
18+
informational: true
19+
paths:
20+
- "src"
521
fixes:
622
- "*/src/::"
23+
ignore:
24+
- "src/gui/styles/**"
25+
- "src/thirdparty/**"
726
comment:
827
require_changes: true

src/CMakeLists.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,6 @@
1616

1717
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
1818

19-
find_library(ZXCVBN_LIBRARIES zxcvbn)
20-
if(NOT ZXCVBN_LIBRARIES)
21-
add_library(zxcvbn STATIC zxcvbn/zxcvbn.c)
22-
# Disable error-level shadow issues
23-
if(CC_HAS_Wshadow_compatible_local)
24-
set_property(SOURCE zxcvbn/zxcvbn.c APPEND PROPERTY COMPILE_OPTIONS "-Wno-shadow-compatible-local")
25-
endif()
26-
if(CC_HAS_Wshadow_local)
27-
set_property(SOURCE zxcvbn/zxcvbn.c APPEND PROPERTY COMPILE_OPTIONS "-Wno-shadow-local")
28-
endif()
29-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/zxcvbn)
30-
set(ZXCVBN_LIBRARIES zxcvbn)
31-
endif(NOT ZXCVBN_LIBRARIES)
32-
3319
set(keepassx_SOURCES
3420
core/Alloc.cpp
3521
core/AutoTypeAssociations.cpp

src/cli/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ set(cli_SOURCES
4545
Show.cpp)
4646

4747
add_library(cli STATIC ${cli_SOURCES})
48-
target_link_libraries(cli Qt5::Core)
48+
target_link_libraries(cli ${ZXCVBN_LIBRARIES} Qt5::Core)
4949

5050
find_package(Readline)
5151

src/thirdparty/zxcvbn/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
add_library(zxcvbn STATIC zxcvbn.c)
2+
# Disable error-level shadow issues
3+
if(CC_HAS_Wshadow_compatible_local)
4+
set_property(SOURCE zxcvbn.c APPEND PROPERTY COMPILE_OPTIONS "-Wno-shadow-compatible-local")
5+
endif()
6+
if(CC_HAS_Wshadow_local)
7+
set_property(SOURCE zxcvbn.c APPEND PROPERTY COMPILE_OPTIONS "-Wno-shadow-local")
8+
endif()
9+
target_include_directories(zxcvbn PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)