[cmake-developers] Cross-compiling with clang

Stephen Kelly steveire at gmail.com
Thu Jun 13 11:39:49 EDT 2013


Brad King wrote:

> On 06/11/2013 07:35 AM, Stephen Kelly wrote:
>>  # CMake workarounds
>>  set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_TOOLCHAIN_LINK_FLAGS} CACHE INTERNAL
>>  "exe link flags") set(CMAKE_MODULE_LINKER_FLAGS
>>  ${CMAKE_TOOLCHAIN_LINK_FLAGS} CACHE INTERNAL "module link flags")
>>  set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_TOOLCHAIN_LINK_FLAGS} CACHE
>>  INTERNAL "shared link flags")
> [snip]
>> The CMake workarounds are needed because I don't think there's a
>> convenient alternative way to specify the -L and -B flags that clang
>> needs.
> 
> The LDFLAGS environment variable should put link flags everywhere.

Setting LDFLAGS is partly useful. It seems to have an equivalent effect as 
setting CMAKE_EXE_LINKER_FLAGS.

However, even when LDFLAGS is set, the ABI compiler test fails, and the 
triple is not automatically determined, or the implicit link dirs etc. Only 
the patch to the CMakeDetermineCompilerABI.cmake file I posted helps with 
that. Is that expected, or is there a bug somewhere there?

> Shouldn't you create a platform file that sets
> CMAKE_*_LINKER_FLAGS_INIT appropriately?

I don't follow your thinking. Would such a file live in the cmake tree? What 
would it be called and what else would it contain?

Thanks,

Steve.





More information about the cmake-developers mailing list