我在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})
答案 0 :(得分:4)
你应该这样做:
LINK_DIRECTORIES("c:/cppunit/lib")
ADD_EXECUTABLE( cpptest ${cppunitest_SRC})
LINK_LIBRARIES(cpptest cppunit)