qinuxman CMake的使用问题
我gcc -D_LARGEFILE64_SOURCE=1 -pthread -I/usr/include/apr-1.0
main.c -o main -lapr-1这样编译可以通过(里面的-lapr-1必须在最后才可以),可是
我cmakelist.txt这么写:project(testapr)
add_executable(testapr main.c )
include_directories(/usr/include/apr-1.0)
link_directories(/usr/lib)
target_link_libraries(apr-1)
add_definitions(-D_LARGEFILE64_SOURCE=1 -pthread)
install(TARGETS testapr RUNTIME DESTINATION bin)
却不对,提示/home/cupid/projects/testapr/main.c:20: undefined reference to
`apr_initialize'
/home/cupid/projects/testapr/main.c:28: undefined reference to
`apr_terminate'
------解决方案--------------------target_link_libraries(testapr apr-1)