sbc100 updated this revision to Diff 252725. sbc100 added a comment. squash
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76653/new/ https://reviews.llvm.org/D76653 Files: clang/CMakeLists.txt clang/lib/Driver/Driver.cpp Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -140,6 +140,13 @@ Dir = std::string(llvm::sys::path::parent_path(ClangExecutable)); InstalledDir = Dir; // Provide a sensible default installed dir. + if (llvm::sys::path::is_relative(SysRoot)) { + // Prepend InstalledDir if SysRoot is relative + SmallString<128> fullpath(InstalledDir); + llvm::sys::path::append(fullpath, SysRoot); + SysRoot = std::string(fullpath); + } + #if defined(CLANG_CONFIG_FILE_SYSTEM_DIR) SystemConfigDir = CLANG_CONFIG_FILE_SYSTEM_DIR; #endif Index: clang/CMakeLists.txt =================================================================== --- clang/CMakeLists.txt +++ clang/CMakeLists.txt @@ -226,7 +226,7 @@ "Colon separated list of directories clang will search for headers.") set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc is installed." ) -set(DEFAULT_SYSROOT "" CACHE PATH +set(DEFAULT_SYSROOT "" CACHE STRING "Default <path> to all compiler invocations for --sysroot=<path>." ) set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -140,6 +140,13 @@ Dir = std::string(llvm::sys::path::parent_path(ClangExecutable)); InstalledDir = Dir; // Provide a sensible default installed dir. + if (llvm::sys::path::is_relative(SysRoot)) { + // Prepend InstalledDir if SysRoot is relative + SmallString<128> fullpath(InstalledDir); + llvm::sys::path::append(fullpath, SysRoot); + SysRoot = std::string(fullpath); + } + #if defined(CLANG_CONFIG_FILE_SYSTEM_DIR) SystemConfigDir = CLANG_CONFIG_FILE_SYSTEM_DIR; #endif Index: clang/CMakeLists.txt =================================================================== --- clang/CMakeLists.txt +++ clang/CMakeLists.txt @@ -226,7 +226,7 @@ "Colon separated list of directories clang will search for headers.") set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc is installed." ) -set(DEFAULT_SYSROOT "" CACHE PATH +set(DEFAULT_SYSROOT "" CACHE STRING "Default <path> to all compiler invocations for --sysroot=<path>." ) set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits