Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJanek Bevendorff <janek@jbev.net>2018-01-14 18:54:23 +0300
committerJonathan White <droidmonkey@users.noreply.github.com>2018-01-14 19:21:17 +0300
commit21a6c0fd89cf44179281feca1ae923c45fc313aa (patch)
tree230f4d10f7600449874386641bb89728c08400d6 /cmake
parent002d374f0c9cc50d2fee4008a6650a4c3e2a9d2c (diff)
Fix linker definition clashes between libargon2 and libsodium on Windows
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindArgon2.cmake17
1 files changed, 15 insertions, 2 deletions
diff --git a/cmake/FindArgon2.cmake b/cmake/FindArgon2.cmake
index 8378ebd54..5f196fc8d 100644
--- a/cmake/FindArgon2.cmake
+++ b/cmake/FindArgon2.cmake
@@ -14,8 +14,21 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
find_path(ARGON2_INCLUDE_DIR argon2.h)
-find_library(ARGON2_LIBRARIES argon2)
+if (MINGW)
+ # find static library on Windows, and redefine used symbols to
+ # avoid definition name conflicts with libsodium
+ find_library(ARGON2_SYS_LIBRARIES libargon2.a)
+ message(STATUS "Patching libargon2...")
+ execute_process(COMMAND objcopy
+ --redefine-sym argon2_hash=libargon2_argon2_hash
+ --redefine-sym argon2_error_message=libargon2_argon2_error_message
+ ${ARGON2_SYS_LIBRARIES} ${CMAKE_BINARY_DIR}/libargon2_patched.a
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
+ find_library(ARGON2_LIBRARIES libargon2_patched.a PATHS ${CMAKE_BINARY_DIR} NO_DEFAULT_PATH)
+else()
+ find_library(ARGON2_LIBRARIES argon2)
+endif()
mark_as_advanced(ARGON2_LIBRARIES ARGON2_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Argon2 DEFAULT_MSG ARGON2_LIBRARIES ARGON2_INCLUDE_DIR) \ No newline at end of file
+find_package_handle_standard_args(Argon2 DEFAULT_MSG ARGON2_LIBRARIES ARGON2_INCLUDE_DIR)