【发布时间】:2014-02-07 14:34:26
【问题描述】:
我想在我的应用程序中构建和使用静态链接的 Botan,这意味着首先
python configure.py --disable shared
紧随其后
make
然后我想为 libbotan.a 创建一个依赖目标作为“libbotan”,我可以在其余的 CMake 文件中使用它。由于 Botan 不使用 CMake,我不确定如何在我的项目中包含依赖项。
我目前的尝试是这样的:
在 deps/Botan.1.11.7/CmakeLists.txt
add_custom_command(OUTPUT botan-configure COMMAND ./configure.py --disable-shared)
add_custom_command(OUTPUT botan-build COMMAND make DEPENDS botan-configure)
add_custom_target(botan DEPENDS botan-configure botan-build)
但是当我像这样在 core/CMakeLists.txt 中添加 botan 作为依赖项时
add_executable(console console.cpp)
target_link_libraries(console messages core botan ${Boost_LIBRARIES})
我明白了
CMake Error at simpleclient/CMakeLists.txt:5 (target_link_libraries):
Target "botan" of type UTILITY may not be linked into another target. One
may link only to STATIC or SHARED libraries, or to executables with the
ENABLE_EXPORTS property set.
我尝试像这样使用 ExternalProject_Add
ExternalProject_Add(botan
GIT_REPOSITORY https://github.com/randombit/botan.git
CONFIGURE_COMMAND python configure.py --disable-shared
BUILD_COMMAND make
INSTALL_COMMAND make install
)
但这给了我同样的错误。
【问题讨论】:
标签: cmake