From 4073b20b7d351cb8c38c537e615e5c81740c424c Mon Sep 17 00:00:00 2001 From: Wojciech Nawrocki Date: Fri, 23 Jul 2021 10:10:31 -0700 Subject: [PATCH] chore: add bcrypt in CMakeLists --- src/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ebbcbd9410..452458e21b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -291,9 +291,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(LEANC_STATIC_LINKER_FLAGS "-lleancpp -lInit -lStd -lLean") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten") set(LEANC_STATIC_LINKER_FLAGS "-lleancpp -lInit -lStd -lLean -lnodefs.js") -elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - # `-pie` defaulting is not consistent on Linux distributions, so let's default to off - set(LEANC_STATIC_LINKER_FLAGS "-no-pie -Wl,--start-group -lleancpp -lInit -lStd -lLean -Wl,--end-group -lbcrypt") else() # `-pie` defaulting is not consistent on Linux distributions, so let's default to off set(LEANC_STATIC_LINKER_FLAGS "-no-pie -Wl,--start-group -lleancpp -lInit -lStd -lLean -Wl,--end-group") @@ -314,6 +311,12 @@ else() set(LEANC_SHARED_LINKER_FLAGS "${LEANC_SHARED_LINKER_FLAGS} -ldl") endif() +# On Windows, add bcrypt for random number generation +if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(LEANC_STATIC_LINKER_FLAGS "${LEANC_STATIC_LINKER_FLAGS} -lbcrypt") + set(LEANC_SHARED_LINKER_FLAGS "${LEANC_SHARED_LINKER_FLAGS} -lbcrypt") +endif() + # Allow `lean` symbols in plugins without linking directly against it. If we linked against the # executable or `leanshared`, plugins would try to look them up at load time (even though they # are already loaded) and probably fail unless we set up LD_LIBRARY_PATH.