meta/CMakeLists.txt
2024-03-01 22:34:29 +08:00

35 lines
1.2 KiB
CMake

cmake_minimum_required(VERSION 3.10)
project(meta LANGUAGES CXX VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_subdirectory(3rdparty/sled EXCLUDE_FROM_ALL)
add_executable(meta
src/main.cc
src/clang/cursor.cc
src/clang/cursor_type.cc
)
### add clang
set(CLANG_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/LLVM/include")
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL "${CMAKE_SYSTEM_NAME} is not supported")
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
message(FATAL "${CMAKE_SYSTEM_NAME} is not supported")
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(OSX_DEVELOPER_ROOT "/Applications/Xcode.app/Contents/Developer/")
set(CLANG_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/LLVM/bin/macOS")
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(CLANG_LIB_LIBRARIES ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib)
else()
set(CLANG_LIB_LIBRARIES "${CLANG_LIB_DIR}/libclang.dylib")
endif()
endif()
target_include_directories(meta PRIVATE ${CLANG_INCLUDE_DIR} src)
target_link_libraries(meta PRIVATE sled ${CLANG_LIB_LIBRARIES})