Skip to content

Commit 781c856

Browse files
authored
Merge pull request #3203 from gottesmm/small_llvmclang_cmake_integration_cleanups
Small llvmclang cmake integration cleanups
2 parents 998dad8 + f6c2532 commit 781c856

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

cmake/modules/SwiftSharedCMakeConfig.cmake

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ macro(swift_common_standalone_build_config_llvm product is_cross_compiling)
8484
"${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}" CACHE STRING
8585
"Version number that will be placed into the libclang library , in the form XX.YY")
8686

87-
set(CMAKE_INCLUDE_CURRENT_DIR ON)
88-
include_directories("${PATH_TO_LLVM_BUILD}/include"
89-
"${LLVM_MAIN_INCLUDE_DIR}")
9087
foreach (INCLUDE_DIR ${LLVM_INCLUDE_DIRS})
9188
include_directories(${INCLUDE_DIR})
9289
endforeach ()
@@ -123,22 +120,14 @@ macro(swift_common_standalone_build_config_clang product is_cross_compiling)
123120

124121
if(NOT EXISTS "${${product}_PATH_TO_CLANG_SOURCE}/include/clang/AST/Decl.h")
125122
message(FATAL_ERROR "Please set ${product}_PATH_TO_CLANG_SOURCE to the root directory of Clang's source code.")
126-
else()
127-
get_filename_component(CLANG_MAIN_SRC_DIR ${${product}_PATH_TO_CLANG_SOURCE}
128-
ABSOLUTE)
129123
endif()
124+
get_filename_component(CLANG_MAIN_SRC_DIR ${${product}_PATH_TO_CLANG_SOURCE}
125+
ABSOLUTE)
130126

131-
if(EXISTS "${${product}_PATH_TO_CLANG_BUILD}/include/clang/Basic/Version.inc")
132-
set(CLANG_BUILD_INCLUDE_DIR "${${product}_PATH_TO_CLANG_BUILD}/include")
133-
elseif(EXISTS "${${product}_PATH_TO_CLANG_BUILD}/tools/clang/include/clang/Basic/Version.inc")
134-
set(CLANG_BUILD_INCLUDE_DIR "${${product}_PATH_TO_CLANG_BUILD}/tools/clang/include")
135-
else()
127+
if(NOT EXISTS "${${product}_PATH_TO_CLANG_BUILD}/tools/clang/include/clang/Basic/Version.inc")
136128
message(FATAL_ERROR "Please set ${product}_PATH_TO_CLANG_BUILD to a directory containing a Clang build.")
137129
endif()
138-
if(CLANG_MAIN_INCLUDE_DIR)
139-
get_filename_component(CLANG_MAIN_SRC_DIR ${${product}_PATH_TO_CLANG_SOURCE}
140-
ABSOLUTE)
141-
endif()
130+
set(CLANG_BUILD_INCLUDE_DIR "${${product}_PATH_TO_CLANG_BUILD}/tools/clang/include")
142131

143132
if (NOT ${is_cross_compiling})
144133
set(${product}_NATIVE_CLANG_TOOLS_PATH "${PATH_TO_LLVM_TOOLS_BINARY_DIR}")

lib/ClangImporter/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ add_swift_library(swiftClangImporter STATIC
2323
swiftParse
2424
)
2525

26+
# Include the current binary dir since we rely on gybed files.
27+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
2628

2729
add_dependencies(swiftClangImporter "${generated_include_targets}")

tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
set(LLVM_TARGET_DEFINITIONS Options.td)
22
swift_tablegen(Options.inc -gen-opt-parser-defs)
33
swift_add_public_tablegen_target(sourcekitdTestOptionsTableGen)
4+
# Add this directories binary directory to the include list to make sure that we
5+
# can properly include Options.inc.
6+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
47

58
if(SWIFT_SOURCEKIT_USE_INPROC_LIBRARY)
69
set(SOURCEKITD_TEST_DEPEND sourcekitdInProc)

0 commit comments

Comments
 (0)