cmake中link_directories无效

1
2
3
4
add_executable(debug ${SOURCE_FILES})
link_directories(libxxx/lib)
target_link_libraries(debug
xxxx)

一直提示找不到xxx库, 解决方法很简单, 就是把add_executable放到link_directories后面就可以了-_-!

1
2
3
4
link_directories(libxxx/lib)
add_executable(debug ${SOURCE_FILES})
target_link_libraries(debug
xxxx)