在我的项目中,我有一个本地图书馆,我正在随该项目一起运送。
因此,我将其包含在cmake文件中
LINK_DIRECTORIES(bls/build/src)
INCLUDE_DIRECTORIES(bls/src)
LINK_DIRECTORIES(bls/build/contrib/relic/lib)
INCLUDE_DIRECTORIES(bls/build/contrib/relic/include)
INCLUDE_DIRECTORIES(bls/contrib/relic/include)
然后将其链接到可执行文件
add_executable(keygen_bls
src/keygen_bls.cpp)
target_link_libraries(keygen_bls blstmp relic_s)
使用此cmake可以正常运行。但是,当我运行make时,我会得到。
/usr/bin/ld: cannot find -lblstmp
/usr/bin/ld: cannot find -lrelic_s
即使这些库位于我上面指定的位置,也不位于/ usr / bin / ld。
项目路径
答案 0 :(得分:0)
感谢有用的评论,使我朝着正确的方向前进,我得以使它得以运行:
INCLUDE_DIRECTORIES(bls/src)
INCLUDE_DIRECTORIES(bls/build/contrib/relic/include)
INCLUDE_DIRECTORIES(bls/contrib/relic/include)
add_library( blstmp STATIC IMPORTED )
set_target_properties( blstmp PROPERTIES IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/bls/build/src/libblstmp.a )
add_library( relic_s STATIC IMPORTED )
set_target_properties( relic_s PROPERTIES IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/bls/build/contrib/relic/lib/librelic_s.a )
除此之外,我注意到git在复制文件时已经排除了库.a文件,这就是为什么它在一开始也不起作用的原因。