[CMake] CXX_COMPILER_FLAGS also passed to the linker?

Bill Hoffman bill.hoffman at kitware.com
Wed Jan 3 09:51:44 EST 2007


Mike Jackson wrote:
>
> Bill,
>   icpc is the Intel C++ compiler. icc is the C compiler.
>
> Exactly.. the flags _do not_ match. If you look closely in all the 
> mumbo jumbo.. in the compile the flag is "-wd981" but in the link 
> phase the flag is "d981". note the missing characters up front. This 
> is causing the problems. So.. CMake bug or operator error?
OK, I know where the problem is....

In Darwin.cmake there is this:

SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)

CMake removes -w because it does not work during the linker stage.  Can 
you try setting those
to empty in your project and see if it works.   The better solution will 
be to fix the c++ code
so that it only removes -w, or removes -w....  up to the next space.

-Bill




More information about the CMake mailing list