[CMake] Eclipse project and MKL libraries

Giovanni Azua bravegag at gmail.com
Fri Apr 27 18:37:16 EDT 2012


Hello Eric,

Thanks for your answer.

On Apr 27, 2012, at 10:44 PM, Eric Noulard wrote:
> What do you mean "executes just fine from the command line"?
> 

I mean that I can build all the targets in command line without problem and execute them without any problems.

>> Linking CXX executable benchmark
>> /usr/bin/cmake -E cmake_link_script CMakeFiles/benchmark.dir/link.txt --verbose=1
>> /usr/bin/c++    -Wall -Wextra -Wshadow -Woverloaded-virtual  -g3 -ggdb3    CMakeFiles/benchmark.dir/test/benchmark.cc.o  -o benchmark -rdynamic libxxxxx.a libxxx_func_fw.a libqr_updates.a -lrt -lmkl_rt -liomp5 -limf -lgfortran -lquadmath
>> /usr/bin/ld: cannot find -lmkl_rt
>> /usr/bin/ld: cannot find -liomp5
>> /usr/bin/ld: cannot find -limf
>> collect2: ld returned 1 exit status
>> make[2]: Leaving directory `/home/bravegag/code/fastcode_project/build'
>> make[1]: Leaving directory `/home/bravegag/code/fastcode_project/build'
>> make[2]: *** [benchmark] Error 1
>> make[1]: *** [CMakeFiles/benchmark.dir/all] Error 2
>> make: *** [all] Error 2
> 
> Looks like you are using
> target_link_library in your CMakeLists.txt without using corresponding
> find module
> Could you give us an excerpt of your CMakeLists.txt?
> Ij particular the CMake script corresponding to your "benchmark" executable.
> 

Here it is:

#*****************************************************************************************

find_package(MKL)

set(HAVE_INTEL_MKL ${MKL_FOUND})
if (MKL_FOUND)
    include_directories(${MKL_INCLUDE_DIRS})
    link_directories(${MKL_LIBRARY_DIRS})
endif()

# [snip]

sfo_executable(benchmark test/benchmark.cc)
target_link_libraries(benchmark submodularity xxx_func_fw qr_updates)
if (UNIX)
  find_library(RT_LIBRARY rt)
  if(RT_LIBRARY)
    target_link_libraries(benchmark ${RT_LIBRARY})
  endif()
endif()

#*****************************************************************************************

Thank you.
Best regards,
Giovanni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120428/6ecb30cc/attachment.htm>


More information about the CMake mailing list