如何让CMake知道库在某个目录中?

时间:2011-01-11 16:35:37

标签: makefile cmake

我在c:\ cppunit \ lib中有一个库,在c:\ cppunit \ include中有一个头文件。 我想出了这个cmake文件来构建库。

如何让CMake知道库位于c:/ cppunit / lib?

PROJECT( cppunitest )
INCLUDE_DIRECTORIES( "c:/cppunit/include" )
??? How to let CMake to know the library is in c:/cppunit/lib
SET( cppunitest_SRC main.cpp testset.cpp complex.cpp  )
LINK_LIBRARIES(cppunit)
ADD_EXECUTABLE( cpptest ${cppunitest_SRC})

1 个答案:

答案 0 :(得分:4)

你应该这样做:

LINK_DIRECTORIES("c:/cppunit/lib")
ADD_EXECUTABLE( cpptest ${cppunitest_SRC})
LINK_LIBRARIES(cpptest cppunit)