[CMake] problem with mac linker flags

Bill Hoffman bill.hoffman at kitware.com
Wed Dec 22 16:24:56 EST 2010


On 12/22/2010 4:15 PM, Richard Wackerbarth wrote:
> The problem is that CMake does not call the linker. It invokes the linker by calling the compiler and passing flags through it.
>
> In the module, Darwin.cmake, you find:
>
>
> SET(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names")
> SET(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names")
>
>
> But in Darwin-icc.cmake, you find:
>
> SET(CMAKE_C_LINK_FLAGS "-headerpad_max_install_names")
> SET(CMAKE_CXX_LINK_FLAGS "-headerpad_max_install_names")
>
> Changing the latter to match the former should fix the issue.
>
So, Darwin-icc.cmake is for the Intel compiler on the Mac.  The intel 
compiler does not want and can not have the -Wl, syntax.  These modules 
need to be updated to the new way of handling compilers.  Right now the 
Mac is using the older style program name matching.  mpicc is matching 
icc, and so CMake tries to use the intel compiler settings when mpicc is 
used.  I bet if you created an alias for mpicc to mpigcc it might work...


-Bill


More information about the CMake mailing list