Skip to content

Commit df2b3ca

Browse files
authored
Merge pull request #4299 from karkhaz/kk-msvc-build-fixes
MSVC build fixes
2 parents 36a1f48 + 0bd112c commit df2b3ca

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
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/ansi-c/library_check.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ for f in "$@"; do
1010
perl -p -i -e 's/(_mm_.fence)/s$1/' __libcheck.c
1111
perl -p -i -e 's/(__sync_)/s$1/' __libcheck.c
1212
perl -p -i -e 's/(__noop)/s$1/' __libcheck.c
13-
$CC -std=gnu99 -E -include library/cprover.h -D__CPROVER_bool=_Bool -D__CPROVER_thread_local=__thread -DLIBRARY_CHECK -o __libcheck.i __libcheck.c
14-
$CC -S -Wall -Werror -pedantic -Wextra -std=gnu99 __libcheck.i -o __libcheck.s -Wno-unused-label
13+
"$CC" -std=gnu99 -E -include library/cprover.h -D__CPROVER_bool=_Bool -D__CPROVER_thread_local=__thread -DLIBRARY_CHECK -o __libcheck.i __libcheck.c
14+
"$CC" -S -Wall -Werror -pedantic -Wextra -std=gnu99 __libcheck.i -o __libcheck.s -Wno-unused-label
1515
ec="${?}"
1616
rm __libcheck.s __libcheck.i __libcheck.c
1717
[ "${ec}" -eq 0 ] || exit "${ec}"

src/cpp/CMakeLists.txt

Lines changed: 4 additions & 2 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-
add_custom_target(cpp_library_check
26-
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/library-check.stamp
25+
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
26+
add_custom_target(cpp_library_check
27+
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/library-check.stamp
2728
)
29+
endif()
2830

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

0 commit comments

Comments
 (0)