File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 42
42
STRINGS src/config.inc CBMC_VERSION
43
43
REGEX "CBMC_VERSION = (.*)" )
44
44
string (REGEX REPLACE "CBMC_VERSION = (.*)" "\\ 1" CBMC_VERSION ${CBMC_VERSION} )
45
+ message (STATUS "Building CBMC version ${CBMC_VERSION} " )
45
46
46
47
project (CBMC VERSION ${CBMC_VERSION} )
47
48
@@ -274,7 +275,7 @@ else()
274
275
275
276
corrosion_import_crate (MANIFEST_PATH src/libcprover-rust/Cargo.toml )
276
277
list (JOIN sat_impl " " sat_impl_str )
277
- corrosion_set_env_vars (cprover-api-rust CBMC_BUILD_DIR=${CMAKE_BINARY_DIR} )
278
+ corrosion_set_env_vars (cprover-api-rust CBMC_BUILD_DIR=${CMAKE_BINARY_DIR} CBMC_VERSION=${CBMC_VERSION} )
278
279
corrosion_link_libraries (cprover-api-rust cprover-api-cpp )
279
280
install (TARGETS cprover-api-rust RUNTIME DESTINATION lib )
280
281
# NOTE: We want to rename to a name consistent with the name of the
Original file line number Diff line number Diff line change @@ -12,6 +12,13 @@ fn get_build_directory() -> Result<String, VarError> {
12
12
env:: var ( "CBMC_BUILD_DIR" )
13
13
}
14
14
15
+ // Passed by the top-level CMakeLists.txt to control which version of the
16
+ // static library of CBMC we're linking against. A user can also change the
17
+ // environment variable to link against different versions of CBMC.
18
+ fn get_cbmc_version ( ) -> Result < String , VarError > {
19
+ env:: var ( "CBMC_VERSION" )
20
+ }
21
+
15
22
fn get_library_build_dir ( ) -> std:: io:: Result < PathBuf > {
16
23
let env_var_fetch_result = get_build_directory ( ) ;
17
24
if let Ok ( build_dir) = env_var_fetch_result {
@@ -50,5 +57,10 @@ fn main() {
50
57
libraries_path. display( )
51
58
) ;
52
59
53
- println ! ( "cargo:rustc-link-lib=static=cprover.5.78.0" ) ;
60
+ let cprover_static_libname = match get_cbmc_version ( ) {
61
+ Ok ( version) => String :: from ( "cprover." ) + & version,
62
+ Err ( err) => panic ! ( "Error: {}" , err) ,
63
+ } ;
64
+
65
+ println ! ( "cargo:rustc-link-lib=static={}" , cprover_static_libname) ;
54
66
}
You can’t perform that action at this time.
0 commit comments