Skip to content

Commit 5b93429

Browse files
authored
Fix CMake configure on Windows
1 parent 3905c28 commit 5b93429

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

CMakeLists.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN")
119119
list(APPEND LTC_C_FLAGS -no-undefined)
120120
endif()
121121

122-
if(MSVC)
123-
cmake_push_check_state()
124-
set(CMAKE_REQUIRED_LIBRARIES bcrypt)
125-
check_symbol_exists(BCryptGenRandom "Windows.h;bcrypt.h" BCRYPT_AVAILABLE)
126-
cmake_pop_check_state()
127-
if(BCRYPT_AVAILABLE)
128-
target_link_libraries(${PROJECT_NAME} PRIVATE Bcrypt)
129-
list(APPEND LTC_C_FLAGS -DLTC_WIN32_BCRYPT)
130-
endif()
131-
endif()
132-
133122
# If the user set the environment variables at generate-time, append them in order to allow
134123
# overriding our defaults.
135124
# ~~~
@@ -160,6 +149,17 @@ set_target_properties(
160149
PUBLIC_HEADER "${PUBLIC_HEADERS}"
161150
)
162151

152+
if(MSVC)
153+
cmake_push_check_state()
154+
set(CMAKE_REQUIRED_LIBRARIES bcrypt)
155+
check_symbol_exists(BCryptGenRandom "Windows.h;bcrypt.h" BCRYPT_AVAILABLE)
156+
cmake_pop_check_state()
157+
if(BCRYPT_AVAILABLE)
158+
target_link_libraries(${PROJECT_NAME} PRIVATE Bcrypt)
159+
list(APPEND LTC_C_FLAGS -DLTC_WIN32_BCRYPT)
160+
endif()
161+
endif()
162+
163163
option(COMPILE_LTO "Build with LTO enabled")
164164
if(COMPILE_LTO)
165165
check_ipo_supported(RESULT COMPILER_SUPPORTS_LTO)

0 commit comments

Comments
 (0)