Skip to content

Commit d2933cb

Browse files
committed
Don't run library check under MSVC
src/ansi-c/library_check.sh does not work under MSVC, as that compiler uses completely different flags. This commit removes the file generated by that script---library-check.stamp---from the dependency graph under cmake. This commit fixes #4295.
1 parent 2168964 commit d2933cb

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/ansi-c/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ add_custom_command(
5050
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
5151
)
5252

53-
add_custom_target(c_library_check
54-
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/library-check.stamp
53+
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
54+
add_custom_target(c_library_check
55+
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/library-check.stamp
5556
)
57+
endif()
5658

5759
################################################################################
5860

@@ -102,6 +104,12 @@ set(extra_dependencies
102104
${CMAKE_CURRENT_BINARY_DIR}/library-check.stamp
103105
)
104106

107+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
108+
list(REMOVE_ITEM
109+
extra_dependencies
110+
${CMAKE_CURRENT_BINARY_DIR}/library-check.stamp)
111+
endif()
112+
105113
file(GLOB_RECURSE sources "*.cpp" "*.h")
106114

107115
list(REMOVE_ITEM sources

src/cpp/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ add_custom_command(
2222
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
2323
)
2424

25+
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
2526
add_custom_target(cpp_library_check
2627
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/library-check.stamp
2728
)
29+
endif()
2830

2931
################################################################################
3032

0 commit comments

Comments
 (0)