[CMake] link against a library under windows
ycollette.nospam at free.fr
ycollette.nospam at free.fr
Mon Jan 31 02:12:49 EST 2011
Hello,
I would like to link against several .lib windows libraries.
So, I set up the link paths via the following commands:
if (MKL_FOUND)
set(LINK_PATHS ${LINK_PATHS} "${mkl_solver_PATH}")
endif (MKL_FOUND)
if (MPI_FOUND)
set(LINK_PATHS ${LINK_PATHS} "${MPI_BASE_PATH}/lib")
endif (MPI_FOUND)
link_directories(${LINK_PATHS})
Now, I list the libraries to link against in a variable: LINK_LIBS
set(LINK_LIBS odbc32 libifport libifcore)
if (MKL_FOUND)
set(LINK_LIBS ${LINK_LIBS} ${ATLAS_LIBRARIES})
endif (MKL_FOUND)
if (MPI_FOUND)
set(LINK_LIBS ${LINK_LIBS} fmpich2)
endif (MPI_FOUND)
target_link_libraries(arc2d ${LINK_LIBS})
Now, if I build my project, there is a link error because a lot of symbols are not found. If I do a nmake VERBOSE=1, I see that the link command has only the last library: fmpich2.
So, my question is: how do I add several libraries in the command "target_link_libraries" and how do I add several paths in link_directories under windows ?
Do I need to add a ".lib" string to each libraries ?
Do I need to add the complete path to each libraries ?
Best regards,
YC
More information about the CMake
mailing list