Skip to content

Commit ea6da0d

Browse files
committed
cmake: fix pkgconfig and cmake interaction
Issue #454
1 parent 1beeb60 commit ea6da0d

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ if(MSVC AND USE_STATIC_MSVC_RUNTIME)
207207
endforeach()
208208
endif()
209209

210-
# Configure pkg-config
211-
find_package(PkgConfig)
210+
if(NOT MSVC)
211+
find_package(PkgConfig)
212+
endif()
213+
212214
file(READ "include/xlsxwriter.h" ver)
213215

214216
string(REGEX MATCH "LXW_VERSION \"([^\"]+)\"" _ ${ver})
@@ -228,7 +230,8 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
228230
if(PKG_CONFIG_FOUND)
229231
pkg_check_modules(ZLIB zlib)
230232
list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
231-
else(NOT ZLIB_FOUND)
233+
endif()
234+
if(NOT ZLIB_FOUND)
232235
find_package(ZLIB "1.0" REQUIRED)
233236
list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
234237
message("zlib version: " ${ZLIB_VERSION})
@@ -239,7 +242,8 @@ if(USE_SYSTEM_MINIZIP)
239242
if(PKG_CONFIG_FOUND)
240243
pkg_check_modules(MINIZIP minizip)
241244
list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}/..)
242-
else(NOT MINIZIP_FOUND)
245+
endif()
246+
if(NOT MINIZIP_FOUND)
243247
find_package(MINIZIP "1.0" REQUIRED)
244248
list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS})
245249
endif()
@@ -288,7 +292,7 @@ if(USE_OPENSSL_MD5)
288292
if(PKG_CONFIG_FOUND)
289293
pkg_check_modules(LIBCRYPTO libcrypto)
290294
include_directories(${LIBCRYPTO_INCLUDE_DIRS})
291-
else(NOT LIBCRYPTO_FOUND)
295+
else()
292296
find_package(OpenSSL REQUIRED)
293297
include_directories(${OPENSSL_INCLUDE_DIR})
294298
message(STATUS "OpenSSL version: ${OPENSSL_VERSION}")

0 commit comments

Comments
 (0)