请帮帮我。我想将 ICU 库添加到我的项目中。我的 cmake 版本是 2.8.12.2。
有 CMakeLists.txt
cmake_minimum_required(版本 2.8)
项目(测试1)
设置(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
设置(CMAKE_CXX_COMPILER /usr/bin/g++)
设置(CMAKE_CXX_FLAGS“${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -W”find_package(Boost 1.54.0 COMPONENTS 文件系统系统正则表达式 unit_test_framework REQUIRED)
find_package(ICU 52.0 REQUIRED)包含目录(${Boost_INCLUDE_DIR})
链接目录(${Boost_LIBRARY_DIR})add_executable(test1 src/dictionary.cpp src/main.cpp)
target_link_libraries(test1 ${Boost_LIBRARIES} pthread)
我已经安装了 ICU 库:libicu-dev、libicu-dev:i386、libicu52、libicu52:i386、libicu52-dbg:i386
但是一旦我运行 CMake,我就会收到以下错误消息:
CMake Error at CMakeLists.txt:10 (find_package):
By not providing "FindICU.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "ICU", but
CMake did not find one.
Could not find a package configuration file provided by "ICU" (requested
version 52.1) with any of the following names:
ICUConfig.cmake
icu-config.cmake
Add the installation prefix of "ICU" to CMAKE_PREFIX_PATH or set "ICU_DIR"
to a directory containing one of the above files. If "ICU" provides a
separate development package or SDK, be sure it has been installed.
Run Code Online (Sandbox Code Playgroud)
我该怎么办?请帮帮我。
Mer*_*ime 10
使用 CMake 3.13。
add_executable(myapp
main.cpp
)
# ICU Components Reference:
# https://cmake.org/cmake/help/latest/module/FindICU.html
# ICU components = data, i18n, io, le, lx, test, tu and uc.
find_package(ICU 61.0 COMPONENTS uc i18n REQUIRED)
# Link using the imported target names (ICU::uc, ICU::i18n, etc.)
target_link_libraries(myapp ICU::uc ICU::i18n)
Run Code Online (Sandbox Code Playgroud)
注意:除非我在 find_package 语句中专门列出了组件,否则这将不起作用。
| 归档时间: |
|
| 查看次数: |
9008 次 |
| 最近记录: |