From 63ead8d92e7b8cfe51cec38544a630f3e4b02943 Mon Sep 17 00:00:00 2001 From: Frederich Munch Date: Wed, 7 Sep 2016 01:22:44 -0400 Subject: [PATCH] Windows: Fix CMake generation of CLING_INCLUDE_PATHS. --- CMakeLists.txt | 20 +++++++++++++++++--- lib/Interpreter/CIFactory.cpp | 6 +++++- lib/Utils/Paths.cpp | 3 ++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29f7ea6b..dd79a51c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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. diff --git a/lib/Interpreter/CIFactory.cpp b/lib/Interpreter/CIFactory.cpp index 3cf39560..3e4d5d85 100644 --- a/lib/Interpreter/CIFactory.cpp +++ b/lib/Interpreter/CIFactory.cpp @@ -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()) { diff --git a/lib/Utils/Paths.cpp b/lib/Utils/Paths.cpp index 51976827..d8e47b8f 100644 --- a/lib/Utils/Paths.cpp +++ b/lib/Utils/Paths.cpp @@ -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 Tmp = Split.second.split(Delim); // Split.first = 'C', but we want 'C:', so Tmp.first.size()+2