mirror of
				https://github.com/Z3Prover/z3
				synced 2025-10-31 11:42:28 +00:00 
			
		
		
		
	Fix Julia bindings linker errors on Windows MSVC
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									ba50899782
								
							
						
					
					
						commit
						3ec4dbd65d
					
				
					 1 changed files with 27 additions and 0 deletions
				
			
		|  | @ -1,5 +1,32 @@ | |||
| find_package(JlCxx REQUIRED) | ||||
| 
 | ||||
| # Check for Windows MSVC + MinGW library compatibility issues | ||||
| if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") | ||||
|     # Get the JlCxx library path to check its format | ||||
|     get_target_property(JLCXX_LIB_PATH JlCxx::cxxwrap_julia IMPORTED_LOCATION) | ||||
|     if(NOT JLCXX_LIB_PATH) | ||||
|         get_target_property(JLCXX_LIB_PATH JlCxx::cxxwrap_julia IMPORTED_LOCATION_RELEASE) | ||||
|     endif() | ||||
|     if(NOT JLCXX_LIB_PATH) | ||||
|         get_target_property(JLCXX_LIB_PATH JlCxx::cxxwrap_julia IMPORTED_IMPLIB) | ||||
|     endif() | ||||
|     if(NOT JLCXX_LIB_PATH) | ||||
|         get_target_property(JLCXX_LIB_PATH JlCxx::cxxwrap_julia IMPORTED_IMPLIB_RELEASE) | ||||
|     endif() | ||||
|      | ||||
|     if(JLCXX_LIB_PATH AND JLCXX_LIB_PATH MATCHES "\\.dll\\.a$") | ||||
|         message(FATAL_ERROR  | ||||
|             "Julia bindings build error: Incompatible CxxWrap library format detected.\n" | ||||
|             "The found libcxxwrap_julia library (${JLCXX_LIB_PATH}) is a MinGW import library (.dll.a), " | ||||
|             "but Z3 is being built with MSVC which requires .lib format.\n\n" | ||||
|             "Solutions:\n" | ||||
|             "1. Use MinGW/GCC instead of MSVC to build Z3\n" | ||||
|             "2. Install a MSVC-compatible version of CxxWrap\n" | ||||
|             "3. Disable Julia bindings with -DZ3_BUILD_JULIA_BINDINGS=OFF\n\n" | ||||
|             "For more information, see: https://github.com/JuliaInterop/CxxWrap.jl#compiling-the-c-code") | ||||
|     endif() | ||||
| endif() | ||||
| 
 | ||||
| add_library(z3jl SHARED z3jl.cpp) | ||||
| target_link_libraries(z3jl PRIVATE JlCxx::cxxwrap_julia libz3) | ||||
| target_include_directories(z3jl PRIVATE | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue