diff --git a/CMakeLists.txt b/CMakeLists.txt index e665f76138..a2ba0e2e6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,14 @@ else () option(BUILD_SHARED_LIBS "Compile shared libraries (if OFF, static libraries are compiled)." ON) endif() + +# Detect whether the user passed BUILD_JULIA_BINDINGS in order to determine if +# we should fail if Julia isn't found. +if (BUILD_JULIA_BINDINGS) + set(FORCE_BUILD_JULIA_BINDINGS ON) +else() + set(FORCE_BUILD_JULIA_BINDINGS OFF) +endif() option(BUILD_JULIA_BINDINGS "Build Julia bindings." ON) # Build Markdown bindings for documentation. This is used as part of website diff --git a/src/mlpack/bindings/julia/CMakeLists.txt b/src/mlpack/bindings/julia/CMakeLists.txt index a1aa87dbb6..62597424ad 100644 --- a/src/mlpack/bindings/julia/CMakeLists.txt +++ b/src/mlpack/bindings/julia/CMakeLists.txt @@ -2,7 +2,12 @@ if (BUILD_JULIA_BINDINGS) ## We need to check here if Julia is even available. Although actually ## technically, I'm not sure if we even need to know! For the tests though we ## do. So it's probably a good idea to check. - find_package(Julia 0.7.0) + if (FORCE_BUILD_JULIA_BINDINGS) + find_package(Julia 0.7.0 REQUIRED) + else () + find_package(Julia 0.7.0) + endif () + if (NOT JULIA_FOUND) # We can't build anything, so define the macro to do nothing. macro (add_julia_binding name)