diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 609e1b4907289504b259f785db5c05305e908ee4..513567925b99fa90ab29df697cd8d974447e59fa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -31,7 +31,7 @@
         - ./rustup.sh -y --default-toolchain beta
         - source ~/.cargo/env
     script:
-        - cmake -Bbuild -DCMAKE_C_COMPILER=${c_compiler} -DCMAKE_CXX_COMPILER=${cxx_compiler} && make -Cbuild
+        - cmake -Bbuild -DCMAKE_RUST_COMPILER=~/.cargo/bin/cargo -DCMAKE_C_COMPILER=${c_compiler} -DCMAKE_CXX_COMPILER=${cxx_compiler} && make -Cbuild
 
 variables:
     GIT_DEPTH: 3 # No need to clone all the history
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f744475d2bcc8cb925cca931b0b7508b5523b267..c1d2fed25c310d584586ee6f414cb704d1483cb7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,6 +111,13 @@ find_program(MKVPROPEDIT mkvpropedit REQUIRED)   # To DL karas and apply metadat
 find_program(XXD         xxd         REQUIRED)   # To embed the sqlite db schemas into the binary
 find_program(CARGO       cargo       REQUIRED)   # For rust things
 
+if(CMAKE_RUST_COMPILER)
+    message(STATUS "Override cargo path: ${CMAKE_RUST_COMPILER}")
+    set(CARGO "${CMAKE_RUST_COMPILER}")
+else()
+    message(STATUS "Using cargo: ${CARGO}")
+endif()
+
 message(STATUS "The installation prefix is ${CMAKE_INSTALL_PREFIX}")
 
 TEST_BIG_ENDIAN(IS_BIG_ENDIAN)