2016-07-02 27 views
2

Hilf mir bitte. Ich möchte meinem Projekt eine ICU-Bibliothek hinzufügen. Meine cmake Version ist 2.8.12.2.Wie fügt man ICU-Bibliothek zum Projekt hinzu?

Es gibt CMakeLists.txt

cmake_minimum_required (VERSION 2.8)

Projekt (test1)

Satz (CMAKE_MODULE_PATH $ {PROJECT_SOURCE_DIR})
Satz (CMAKE_CXX_COMPILER /usr/bin/g ++)
set (CMAKE_CXX_FLAGS "$ { } CMAKE_CXX_FLAGS -D_GLIBCXX_USE_CXX11_ABI = 0 -std = C++ 11 -Wall")

find_package (Boost-1.54.0 COMPONENTS Dateisystem System regex unit_test_framework ERFORDERLICH)
find_package (ICU 52,0 ERFORDERLICH)

include_directories ($ {Boost_INCLUDE_DIR})
link_directories ($ {Boost_LIBRARY_DIR})

add_executable (test1 src/dictionary.cpp src/main.cpp )
target_link_libraries (test1 $ {} Boost_LIBRARIES pthread )

Ich habe installiert ICU-Bibliotheken: libicu-dev, libicu-dev: i386, libicu52, libicu52: i386, libicu52-dbg: i386

Aber sobald ich CMake laufen, bekomme ich folgende Fehlermeldung:

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. 

Was soll ich tun? Hilf mir bitte.

Antwort

2

Dieses Problem wurde durch Hinzufügen der Datei FindICU.cmake an der Spitze der Projektverzeichnis von Website github.com/julp/FindICU.cmake

+0

Seit der Version 3.7.0 [CMake kommt mit einem verpackt 'FindICU.cmake'] (https://cmake.org/cmake/help /v3.7/module/FindICU.html#module:FindICU), die jedoch anders als julp funktioniert (dh inkompatibel ist). – DevSolar

0

Es geht darum, einschließlich der Header und die Verknüpfung der Bibliotheken gelöst. Für kleine Projekte, können Sie wahrscheinlich nur tun, (vorausgesetzt, dass Sie bereits haben ICU richtig installiert ist, und kann manuell ausgeführt werden)

include_directories(${ICU_INCLUDE_DIRS}) 
link_directories(${ICU_LIBRARY_DIRS}) 
add_executable(test1 src/dictionary.cpp src/main.cpp) 
target_link_libraries(test1 ${ICU_LIBRARIES}) 

Sie unten verwenden können, die Informationen zu drucken, wenn Sie „cmake“ überprüfen, ob Cmake laufen findet den richtigen Pfad.

MESSAGE("ICU_INCLUDE_DIRS: " ${ICU_INCLUDE_DIRS}) 

Die Cmake Version ich verwende ist 3.5.2