[CMake] Eclipse project and MKL libraries

Eric Noulard eric.noulard at gmail.com
Sat Apr 28 02:56:58 EDT 2012


2012/4/28 Giovanni Azua <bravegag at gmail.com>:

>> 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.

Command line that you crafted by hand or command line generated
by CMake using say Makefile generator?

[...]

>> 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()

Using link_directories is as stated in the documentation
"rarely necessary"
see cmake --help-command link_directories

You should bettte use absolute path to libraries in your
target_link_libraries(benchmark ....)

thus for MKL package you should do something like:

target_link_libraries(benchmark ${MKL_LIBRARIES})

I cannot ensure this is OK because the FindMKL.cmake module
does not seem to be in CMake source.


> # [snip]
>
> sfo_executable(benchmark test/benchmark.cc)
> target_link_libraries(benchmark submodularity xxx_func_fw qr_updates)


again if submodularity xxx_func_fw qr_updates are library target
from you projevct its ok if they are external libraries you should
find their complete path and use them.

> if (UNIX)
>   find_library(RT_LIBRARY rt)
>   if(RT_LIBRARY)
>     target_link_libraries(benchmark ${RT_LIBRARY})
>   endif()
> endif()
>
> #*****************************************************************************************
>
> Thank you.
> Best regards,
> Giovanni



-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list