On 04/14/2014 05:30 PM, Zaak Beekman wrote:
> The problem is that the link step adds spurious (intel) libraries
> when linking the executable.

This is related to the mixed-language support, usually used for linking
C++/Fortran together.  When computing a link line CMake looks at all
the languages that it knows have been compiled into object files
involved in the link.  It wants to ensure that the libraries normally
added by the compiler for each language will appear.  Whatever lang's
compiler is used to drive the link has a known set of libraries.  All
other libraries implicitly used by the other languages will be added
to the link line explicitly.

Look at the CMakeFiles/<cmake-version>/CMake(C|Fortran)Compiler.cmake
files in the build tree.  There should be lines that set variables
like CMAKE_C_IMPLICIT_LINK_LIBRARIES.  Also look at the log file
CMakeFiles/CMakeOutput.log for content following lines like

 Parsed C implicit link information from above output

and

 Parsed Fortran implicit link information from above output

That has verbose information about how CMake detects these libraries.
Likely the detection is being done using executables that are not
linked statically.  Since CMake has no first-class support for
specifying that an executable should be linked statically this use
case was not considered previously for mixed-language support.

If after enabling languages you do

 set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "")
 set(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "")

the extra libraries should no longer appear.

-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://www.cmake.org/mailman/listinfo/cmake

Reply via email to