[cmake-developers] cmake_cxx_link_executable issue
Nils Gladitz
nilsgladitz at gmail.com
Tue Jun 24 03:37:52 EDT 2014
On 06/24/2014 09:15 AM, Piotr Bialek wrote:
This might have been more appropriate for the user's mailing list since
it does not involve development of CMake itself.
> I'm trying to cross compile with clang. I set cmake_compiler,
> cmake_linker, etc.
> During the linking CXX executable all flags, libs, files, etc. are
> getting from somehow created file ./Main/CMakeFiles/Build.dir/link.txt.
>
> The problem is, that when I change linker by setting
> CMAKE_CXX_LINK_EXECUTABLE, no files or flags are generated in link.txt
> and I get message like: "x86_64-pc-linux-gnu-ld: no input files".
The CMAKE_CXX_LINK_EXECUTABLE variable does not refer to the linker
executable.
It contains the rule used to link executables:
http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_LANG_LINK_EXECUTABLE.html
You shouldn't have to modify it.
For a link CMake calls the compiler (and the compiler invokes the linker).
To set the compiler you can use:
http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_LANG_COMPILER.html
Or the CC and CXX environment variables.
The compilers have to be set on the initial CMake run.
For a native build with clang on GNU/Linux this can be as simple as e.g.:
CC=clang CXX=clang++ cmake [...]
Nils
More information about the cmake-developers
mailing list