Skip to content

Commit 1dc6da9

Browse files
committed
build: only attempt to install MSVC system libraries on Windows
Newer versions of CMake attempt to query the system for information about the VS 2017 installation. Unfortunately, this query fails on non-Windows systems when cross-compiling: cmake_host_system_information does not recognize <key> VS_15_DIR CMake will not find these system libraries on non-Windows hosts anyways, and we were silencing the warnings, so simply omit the installation when cross-compiling to Windows.
1 parent 9427186 commit 1dc6da9

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ endif()
3939
set(CMAKE_C_VISIBILITY_PRESET hidden)
4040
set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE)
4141

42+
if(NOT MSVC OR CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
43+
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
44+
include(InstallRequiredSystemLibraries)
45+
endif()
46+
47+
4248
# Compiler flags
4349
if(MSVC)
4450
add_compile_options($<$<COMPILE_LANGUAGE:C>:/W4>)

extensions/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ if (CMARK_STATIC)
6161
list(APPEND CMARK_INSTALL ${STATICLIBRARY})
6262
endif()
6363

64-
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
65-
66-
include (InstallRequiredSystemLibraries)
6764
install(TARGETS ${CMARK_INSTALL}
6865
EXPORT cmark-gfm-extensions
6966
RUNTIME DESTINATION bin

src/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,6 @@ if (MSVC)
128128
APPEND PROPERTY LINK_FLAGS /INCREMENTAL:NO)
129129
endif(MSVC)
130130

131-
if(NOT MSVC OR CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
132-
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
133-
include(InstallRequiredSystemLibraries)
134-
endif()
135-
136131
set(libdir lib${LIB_SUFFIX})
137132

138133
install(TARGETS ${PROGRAM} ${CMARK_INSTALL}

0 commit comments

Comments
 (0)