Skip to content

Commit 9c5a5c4

Browse files
author
Thomas Kiley
committed
Add dependency to cprover_library.inc for the C++ module
This ensures that the library is actually built (and therefore used) by the C++ frontend (otherwise, the CMake version never genreates cprover_library.inc and the C version of the file is imported twice. Also mirrored the changes made in the ansi-c CMakeLists.txt which detects changes in the source of the library
1 parent 64f1c3d commit 9c5a5c4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/cpp/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
file(GLOB cpp_library_sources "library/*.c")
22

3-
add_custom_command(OUTPUT converter_input.txt
4-
COMMAND cat ${cpp_library_sources} > converter_input.txt
5-
DEPENDS ${cpp_library_sources}
6-
)
7-
83
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cprover_library.inc"
9-
COMMAND ../ansi-c/converter < "converter_input.txt" > "${CMAKE_CURRENT_BINARY_DIR}/cprover_library.inc"
10-
DEPENDS "converter_input.txt" ../ansi-c/converter
11-
)
4+
COMMAND cat ${cpp_library_sources} | $<TARGET_FILE:converter> > "${CMAKE_CURRENT_BINARY_DIR}/cprover_library.inc"
5+
DEPENDS converter ${cpp_library_sources})
126

137
################################################################################
148

@@ -33,6 +27,12 @@ endif()
3327
file(GLOB_RECURSE sources "*.cpp" "*.h")
3428
add_library(cpp ${sources})
3529

30+
set_source_files_properties(
31+
${sources}
32+
PROPERTIES
33+
OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/cprover_library.inc"
34+
)
35+
3636
generic_includes(cpp)
3737

3838
target_link_libraries(cpp util ansi-c)

0 commit comments

Comments
 (0)