Skip to content

Commit d448df1

Browse files
authored
Merge pull request #689 from momo5502/develop
Fix CMake configure on Windows
2 parents 3905c28 + aeccd41 commit d448df1

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-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)

appveyor.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,19 @@ build_script:
2121
cd..
2222
git clone https://github.com/libtom/libtommath.git --branch=master
2323
cd libtommath
24+
mkdir build
25+
cd build
26+
cmake -G "Ninja" ..
27+
ninja
28+
cd..
2429
nmake -f makefile.msvc
2530
cd..
2631
cd libtomcrypt
32+
mkdir build
33+
cd build
34+
cmake -G "Ninja" ..
35+
ninja
36+
cd..
2737
nmake -f makefile.msvc all
2838
test_script:
2939
- cmd: test.exe

0 commit comments

Comments
 (0)