Ericson2314 created this revision. Ericson2314 added reviewers: arichardson, compnerd, phosek, beanz. Herald added subscribers: libcxx-commits, mgorny. Herald added a reviewer: bollu. Herald added a reviewer: ldionne. Herald added projects: libunwind, Flang. Herald added a reviewer: libunwind. Ericson2314 requested review of this revision. Herald added subscribers: llvm-commits, lldb-commits, jdoerfert. Herald added projects: LLDB, libc++, libc++abi, LLVM. Herald added a reviewer: libc++. Herald added a reviewer: libc++abi.
We had two related problems with `GNUInstallDirs`: 1. It might default to `lib64`, clashing with LLVM's own `*_LIBDIR_SUFFIX`. I haven't used `CMAKE_INSTALL_LIBDIR` so far for this very reason. 2. Its defaulting logic must go after `project(..)` to work correctly, but `project(..)` is often in a standalone condition making this awkward, since the rest of the condition code may also need GNUInstallDirs. A simple solution is to just default `CMAKE_INSTALL_LIBDIR` ourselves, which avoids both issues. I did this with a little copy-pasted code, but we could factor it out in `/cmake` instead. I didn't do that yet because it would mean moving the module path manipulations instead. But if that is desired, I will do it. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D117639 Files: flang/CMakeLists.txt libcxx/CMakeLists.txt libcxxabi/CMakeLists.txt libunwind/CMakeLists.txt lld/CMakeLists.txt lldb/CMakeLists.txt llvm/CMakeLists.txt polly/CMakeLists.txt pstl/CMakeLists.txt
Index: pstl/CMakeLists.txt =================================================================== --- pstl/CMakeLists.txt +++ pstl/CMakeLists.txt @@ -7,6 +7,10 @@ #===----------------------------------------------------------------------===## cmake_minimum_required(VERSION 3.13.4) +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + # No suffixes by default: LLVM does those separately. + set(CMAKE_INSTALL_LIBDIR lib) +endif() include(GNUInstallDirs) set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h") Index: polly/CMakeLists.txt =================================================================== --- polly/CMakeLists.txt +++ polly/CMakeLists.txt @@ -1,3 +1,7 @@ +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + # No suffixes by default: LLVM does those separately. + set(CMAKE_INSTALL_LIBDIR lib) +endif() include(GNUInstallDirs) # Check if this is a in tree build. Index: llvm/CMakeLists.txt =================================================================== --- llvm/CMakeLists.txt +++ llvm/CMakeLists.txt @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.13.4) +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + # No suffixes by default: LLVM does those separately. + set(CMAKE_INSTALL_LIBDIR lib) +endif() include(GNUInstallDirs) # CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()` Index: lldb/CMakeLists.txt =================================================================== --- lldb/CMakeLists.txt +++ lldb/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.13.4) +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + # No suffixes by default: LLVM does those separately. + set(CMAKE_INSTALL_LIBDIR lib) +endif() include(GNUInstallDirs) # Add path for custom modules. Index: lld/CMakeLists.txt =================================================================== --- lld/CMakeLists.txt +++ lld/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.13.4) +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + # No suffixes by default: LLVM does those separately. + set(CMAKE_INSTALL_LIBDIR lib) +endif() include(GNUInstallDirs) # If we are not building as a part of LLVM, build LLD as an Index: libunwind/CMakeLists.txt =================================================================== --- libunwind/CMakeLists.txt +++ libunwind/CMakeLists.txt @@ -8,6 +8,10 @@ cmake_minimum_required(VERSION 3.13.4) +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + # No suffixes by default: LLVM does those separately. + set(CMAKE_INSTALL_LIBDIR lib) +endif() include(GNUInstallDirs) set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") Index: libcxxabi/CMakeLists.txt =================================================================== --- libcxxabi/CMakeLists.txt +++ libcxxabi/CMakeLists.txt @@ -10,6 +10,10 @@ cmake_minimum_required(VERSION 3.13.4) +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + # No suffixes by default: LLVM does those separately. + set(CMAKE_INSTALL_LIBDIR lib) +endif() include(GNUInstallDirs) set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") Index: libcxx/CMakeLists.txt =================================================================== --- libcxx/CMakeLists.txt +++ libcxx/CMakeLists.txt @@ -10,6 +10,10 @@ #=============================================================================== cmake_minimum_required(VERSION 3.13.4) +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + # No suffixes by default: LLVM does those separately. + set(CMAKE_INSTALL_LIBDIR lib) +endif() include(GNUInstallDirs) set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") Index: flang/CMakeLists.txt =================================================================== --- flang/CMakeLists.txt +++ flang/CMakeLists.txt @@ -7,6 +7,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE) set(CMAKE_CXX_EXTENSIONS OFF) +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + # No suffixes by default: LLVM does those separately. + set(CMAKE_INSTALL_LIBDIR lib) +endif() include(GNUInstallDirs) set(FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits