On 10/30/2015 03:05 PM, Chris Bieneman wrote: > equivalent of try_compile that will test building a static archive > instead of an executable?
For the "source file" signature of try_compile there is currently no such option. The try_compile command also has a mode that builds an entire source tree and of course then one could specify any type of target because one writes the entire CMakeLists.txt file explicitly. That doesn't help for the builtin checks and such though. For the basic try_compile signature we hard-code add_executable here: https://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmCoreTryCompile.cxx;hb=v3.3.2#l477 We could consider an option to try_compile to ask it to use add_library(... STATIC ...) instead of add_executable. However, for your use case one needs this to work for the existing check modules that CMake has, not just for your own try_compile calls. IIUC in your case you have an already-built cross-compiler and are running CMake on the project that provides the builtins. This project uses some of CMake's compiler/platform check macros. We need to make these checks work without running a linker because the cross-compiler cannot link until the builtins are built. Are you setting CMAKE_TOOLCHAIN_FILE for the build of the builtins? What we need is for try_compile to learn to check for some global option to be set by a toolchain or platform information module that tells it there is no linker. Then try_compile could handle this case by using add_library(... STATIC ...). -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers