Skip to content
Snippets Groups Projects
Commit 9d0a93f0 authored by NAKAMURA Takumi's avatar NAKAMURA Takumi
Browse files

[CMake][Modules] libclang: Ignore _CINDEX_LIB_ and CLANG_TOOL_EXTRA_BUILD for -fmodules.

CLANG_TOOL_EXTRA_BUILD doesn't affect headers.

_CINDEX_LIB_ is defined when the target is SHARED.
On Win32, it affects clang-c/Platform.h and it shouldn't be ignored.

This is part of https://reviews.llvm.org/D35559

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309557 91177308-0d34-0410-b5e6-96231b3b80d8
parent 80f50978
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,9 @@ if (TARGET clangTidyPlugin)
add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
list(APPEND LIBS clangTidyPlugin)
list(APPEND LIBS clangIncludeFixerPlugin)
if(LLVM_ENABLE_MODULES)
list(APPEND LLVM_COMPILE_FLAGS "-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
endif()
endif ()
find_library(DL_LIBRARY_PATH dl)
......@@ -115,6 +118,12 @@ if(ENABLE_SHARED)
PROPERTIES
VERSION ${LIBCLANG_LIBRARY_VERSION}
DEFINE_SYMBOL _CINDEX_LIB_)
# FIXME: _CINDEX_LIB_ affects dllexport/dllimport on Win32.
if(LLVM_ENABLE_MODULES AND NOT WIN32)
target_compile_options(libclang PRIVATE
"-fmodules-ignore-macro=_CINDEX_LIB_"
)
endif()
endif()
endif()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment