Windows: Fix CMake generation of CLING_INCLUDE_PATHS.

This commit is contained in:
Frederich Munch 2016-09-07 01:22:44 -04:00 committed by sftnight
parent f933a88800
commit 63ead8d92e
3 changed files with 24 additions and 5 deletions

View File

@ -364,17 +364,31 @@ option(CLING_INCLUDE_TESTS
"Generate build targets for the Cling unit tests."
${LLVM_INCLUDE_TESTS})
if (NOT WIN32)
set(cling_path_delim ":")
else()
set(cling_path_delim ";")
endif()
#Allow user to prepend to list via cmake -DCLING_INCLUDE_PATHS=
set(cling_include_deflt "\
${CMAKE_INSTALL_PREFIX}/include:${CMAKE_CURRENT_SOURCE_DIR}/include:\
${CMAKE_CURRENT_SOURCE_DIR}/../clang/include:\
${CMAKE_INSTALL_PREFIX}/include${cling_path_delim}\
${CMAKE_CURRENT_SOURCE_DIR}/include${cling_path_delim}\
${CMAKE_CURRENT_SOURCE_DIR}/../clang/include${cling_path_delim}\
${CMAKE_CURRENT_SOURCE_DIR}/../../include"
)
if (WIN32)
set(cling_include_deflt "${cling_include_deflt}${cling_path_delim}\
${CMAKE_BINARY_DIR}/include${cling_path_delim}\
${CMAKE_BINARY_DIR}/tools/clang/include"
)
endif()
if(NOT CLING_INCLUDE_PATHS)
set(CLING_INCLUDE_PATHS "${cling_include_deflt}")
else()
set(CLING_INCLUDE_PATHS "${CLING_INCLUDE_PATHS}:${cling_include_deflt}")
set(CLING_INCLUDE_PATHS "${CLING_INCLUDE_PATHS}${cling_path_delim}${cling_include_deflt}")
endif()
# All targets below may depend on all tablegen'd files.

View File

@ -935,7 +935,11 @@ namespace {
#ifdef CLING_INCLUDE_PATHS
if (HOpts.Verbose)
llvm::errs() << " \"" CLING_INCLUDE_PATHS "\"\n";
utils::AddIncludePaths(CLING_INCLUDE_PATHS, HOpts);
#ifndef _WIN32
utils::AddIncludePaths(CLING_INCLUDE_PATHS, HOpts, ":");
#else
utils::AddIncludePaths(CLING_INCLUDE_PATHS, HOpts, ";");
#endif
#endif
llvm::SmallString<512> P(ClingBin);
if (!P.empty()) {

View File

@ -133,7 +133,8 @@ bool SplitPaths(llvm::StringRef PathStr,
#ifdef _MSC_VER
// TODO: Should this all go away and have user handle platform differences?
// Right now CMake is generating 'C:\User\Path:G:\Another\Path' so it can't
// Right now there are issues with CMake updating cling-compiledata.h
// and it was previoulsy generating 'C:\User\Path:G:\Another\Path'
if (!Exists && WindowsColon && Split.first.size()==1) {
std::pair<llvm::StringRef, llvm::StringRef> Tmp = Split.second.split(Delim);
// Split.first = 'C', but we want 'C:', so Tmp.first.size()+2