From 8054a8a31a23237b5b3338004fb680b3506adf8a Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Wed, 26 Mar 2025 21:43:27 +0000 Subject: [PATCH] Allow the relevant Rust target triple to be supplied to CMake --- cxx/CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cxx/CMakeLists.txt b/cxx/CMakeLists.txt index 119255a7..11cfda75 100644 --- a/cxx/CMakeLists.txt +++ b/cxx/CMakeLists.txt @@ -25,17 +25,24 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) ############################## add_library(libloot-cxx STATIC IMPORTED) + if(MSVC) set(LIBLOOT_CXX_FILENAME "libloot_cxx.lib") else() set(LIBLOOT_CXX_FILENAME "liblibloot_cxx.a") endif() +if(DEFINED RUST_TARGET) + set(TARGET_PATH "${CMAKE_SOURCE_DIR}/../target/${RUST_TARGET}") +else() + set(TARGET_PATH "${CMAKE_SOURCE_DIR}/../target") +endif() + set_target_properties(libloot-cxx PROPERTIES IMPORTED_CONFIGURATIONS "Release;Debug" - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/../target/release/${LIBLOOT_CXX_FILENAME}" - IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/../target/debug/${LIBLOOT_CXX_FILENAME}") -target_include_directories(libloot-cxx INTERFACE "${CMAKE_SOURCE_DIR}/../target/cxxbridge") + IMPORTED_LOCATION "${TARGET_PATH}/release/${LIBLOOT_CXX_FILENAME}" + IMPORTED_LOCATION_DEBUG "${TARGET_PATH}/debug/${LIBLOOT_CXX_FILENAME}") +target_include_directories(libloot-cxx INTERFACE "${TARGET_PATH}/cxxbridge") ##############################