16 // When the cmake crate detects the clang compiler, it passes the
17 // "--target" argument to the linker which subsequently fails. The
18 // `CMAKE_C_COMPILER_FORCED` option makes sure that `cmake` does not
19 // tries to test the compiler. From version 3.6 the option
20 // `CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY` can be used
21 // https://cmake.org/cmake/help/v3.5/module/CMakeForceCompiler.html
22 let dst = cmake::Config::new("libcmake_foo")
23 .build_target("cmake_foo")
24 .define("CMAKE_C_COMPILER_FORCED", "1")
25 .define("CMAKE_CXX_COMPILER_FORCED", "1")
26 .define("CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY", "1")
28 println!("cargo:rustc-link-search=native={}/build/", dst.display());
29 println!("cargo:rustc-link-lib=static=cmake_foo");