Skip to content

Commit

Permalink
use link_libraries in try_compile instead of pragma lib in cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
malytomas authored and zpostfacto committed Sep 9, 2024
1 parent 5020374 commit 62b3951
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ if (WIN32)
#
# Check whether BCrypt can be used with this SDK version
#
try_compile(BCRYPT_AVAILABLE "${CMAKE_CURRENT_BINARY_DIR}/tryCompile" SOURCES "${CMAKE_CURRENT_LIST_DIR}/cmake/tryCompileTestBCrypt.cpp" OUTPUT_VARIABLE BCRYPT_AVAILABILITY_TEST_MESSAGES)
try_compile(BCRYPT_AVAILABLE "${CMAKE_CURRENT_BINARY_DIR}/tryCompile" SOURCES "${CMAKE_CURRENT_LIST_DIR}/cmake/tryCompileTestBCrypt.cpp" LINK_LIBRARIES bcrypt OUTPUT_VARIABLE BCRYPT_AVAILABILITY_TEST_MESSAGES)
if (NOT BCRYPT_AVAILABLE)
message(STATUS ${BCRYPT_AVAILABILITY_TEST_MESSAGES})
message(FATAL_ERROR "You're on Windows but BCrypt seems to be unavailable, you will need OpenSSL")
Expand Down
1 change: 0 additions & 1 deletion cmake/tryCompileTestBCrypt.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <Windows.h>
#include <bcrypt.h>
#include <cstdio>
#pragma comment(lib, "bcrypt.lib")

int main(int, char **)
{
Expand Down

0 comments on commit 62b3951

Please sign in to comment.