[CMake] Linking intel (icpc/icc) compiled libraries with gnu (g++/gcc/ar) compiled targets

Pettey . Lucas LPettey at drc.com
Tue Jan 28 10:14:30 EST 2014


Do you have a line similar to target_link_libraries(foo.exe ${IntelCompilerLibrary_LIBRARIES})?

Also check to see if IntelCompilerLibrary_LIBRARIES is being set correctly by having it print out in a message. I have had times where the entire SET needs the quotes: SET(IntelCompilerLibrary_LIBRARIES "${IntelCompilerLibrary_LIBRARIES} ${lib}")

Hope this helps,
Lucas

________________________________________
From: CMake [cmake-bounces at cmake.org] on behalf of jmerkow [jmerkow at gmail.com]
Sent: Monday, January 27, 2014 4:26 PM
To: cmake at cmake.org
Subject: [CMake] Linking intel (icpc/icc) compiled libraries with gnu (g++/gcc/ar) compiled targets

Hello,

I am working on migrating from for an established project make to cmake, and
I have an interesting problem.

Some of the precompiled libraries are compiled using intel compilers and
some are compiled using g++. Since icc is licensed and harder to get we have
been using g++ and linking with the intel libraries (build using makefiles).

Now, we are moving to CMake I am trying to accomplish the same thing. To
test this, I am trying to compile the project using the an intel compiled
VTK library (i.e. VTK was compiled with icc/icpc) and while linking and
compiling the rest of the application using gnu, (ar, g++, etc). The intel
libraries need for this are libirc, libimf, libsvml.  I have these
libraries, but they do not seem to be linking properly, or I am missing a
step in this process.

I am doing this with a loop which finds the path for each of the libraries,
adds them and concatenates them to the libraries list.  This what a single
iteration looks like (I pulled it out of the loop for readability)

set(lib "irc") #(this is actually set by a loop)
set(IntelCompilerLibrary_LIBRARY "/full/path/to/libirc.so") #(this is
actually set by a loop)

add_library(${lib} UNKNOWN IMPORTED)
set_property(TARGET ${lib} PROPERTY IMPORTED_LOCATION
"${IntelCompilerLibrary_LIBRARY}")

SET(IntelCompilerLibrary_LIBRARIES ${IntelCompilerLibrary_LIBRARIES}
"${lib}")

I believe that I am adding the precompiled libraries correctly according to
the wiki
(http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets),
but I continue to get undefined references to the intel methods.

Any help is much appreciated!!





--
View this message in context: http://cmake.3232098.n2.nabble.com/Linking-intel-icpc-icc-compiled-libraries-with-gnu-g-gcc-ar-compiled-targets-tp7586615.html
Sent from the CMake mailing list archive at Nabble.com.
--

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
________________________________

This electronic message transmission and any attachments that accompany it contain information from DRC® (Dynamics Research Corporation) or its subsidiaries, or the intended recipient, which is privileged, proprietary, business confidential, or otherwise protected from disclosure and is the exclusive property of DRC and/or the intended recipient. The information in this email is solely intended for the use of the individual or entity that is the intended recipient. If you are not the intended recipient, any use, dissemination, distribution, retention, or copying of this communication, attachments, or substance is prohibited. If you have received this electronic transmission in error, please immediately reply to the author via email that you received the message by mistake and also promptly and permanently delete this message and all copies of this email and any attachments. We thank you for your assistance and apologize for any inconvenience.


More information about the CMake mailing list