On 02/17/2016 01:46 PM, James Crosby wrote:
>> Perhaps we could have a setting in a toolchain file like
[snip]
>> that tells CMake to use add_library(STATIC) instead of add_executable()
>> in its generated try_compile projects.  That would avoid linking through
>> the toolchain.
> 
> OK this makes a lot more sense to me now (I should have looked at the code
> first ;). It seems like the option to link a static library would have all the
> benefits of getting information out of the compiler itself (instead of
> duplicating it in toolchain files), without having to be able to produce a
> linkable executable.

Here is a change implementing this approach:

 try_compile: Add option to control type of target
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7f1bd9fe

One should be able to simply add

    set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

to the toolchain file.  Then CMakeForceCompiler should not be needed anymore.

Please try it out.

Thanks,
-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

Reply via email to