1

シンプルなclang ASTカーソルトラベラーを書こうとしています。

https://github.com/dyhe83/clang-AST-cursor-traveler

この次の cmake コードは Linux で正常に動作します。

PROJECT(traveler)

FIND_LIBRARY(LIBCLANG_PATH
    clang HINTS /usr/local/lib/
)

ADD_EXECUTABLE(traveler 
    traveler.cpp
)

TARGET_LINK_LIBRARIES(traveler
    ${LIBCLANG_PATH}
)

この例を Windows でも実行したいと思います。

私のLLVMは「C:\Program Files (x86)\LLVM」にビルドされています フォルダ

しかし、CMakeLists.txt の FIND_LIBRARY 部分を変更した後。

FIND_LIBRARY(LIBCLANG_PATH
    clang HINTS "C:\\Program Files (x86)\\LLVM\\lib"
)

いくつかのエラーが発生します:

D:\WorkSpace\C\clang-AST-cursor-traveler\build>cmake ..
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.16.27025.1
-- The CXX compiler identification is MSVC 19.16.27025.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
LIBCLANG_PATH
    linked by target "traveler" in directory D:/WorkSpace/C/clang-AST-cursor-traveler/src

-- Configuring incomplete, errors occurred!
See also "D:/WorkSpace/C/clang-AST-cursor-traveler/build/CMakeFiles/CMakeOutput.log".

また、「C:\Program Files (x86)\LLVM\lib」にライブラリがあります。 LibClang

Windowsのclangライブラリの正しいパスがどこにあるか知っている人はいますか??

4

1 に答える 1