[PATCH] D74347: [CMake] Explicitly specify paths to libc++abi in CrossWinToARMLinux.cmake

Vlad Vereschaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 11 22:33:38 PDT 2020


vvereschaka added a comment.

I tried to reproduce the problem on the builder in a temporary folder and I found that CMAKE_SOURCE_DIR == CMAKE_BINARY_DIR == <build_dir>.
Here is a list of all CMAKE_ variables available on a moment of initial configuration:

  -- CMAKE_AR: c:/buildbot/temp/build/bin/llvm-ar.exe
  -- CMAKE_BINARY_DIR: C:/buildbot/temp/build
  -- CMAKE_BUILD_TYPE: Release
  -- CMAKE_CL_SHOWINCLUDES_PREFIX: Note: including file:
  -- CMAKE_COMMAND: C:/Program Files/CMake/bin/cmake.exe
  -- CMAKE_CPACK_COMMAND: C:/Program Files/CMake/bin/cpack.exe
  -- CMAKE_CROSSCOMPILING: ON
  -- CMAKE_CTEST_COMMAND: C:/Program Files/CMake/bin/ctest.exe
  -- CMAKE_CURRENT_BINARY_DIR: C:/buildbot/temp/build
  -- CMAKE_CURRENT_LIST_DIR: C:/buildbot/temp/llvm-project/clang/cmake/caches
  -- CMAKE_CURRENT_LIST_FILE: C:/buildbot/temp/llvm-project/clang/cmake/caches/CrossWinToARMLinux.cmake
  -- CMAKE_CURRENT_SOURCE_DIR: C:/buildbot/temp/build
  -- CMAKE_CXX_FLAGS: -D__OPTIMIZE__
  -- CMAKE_C_COMPILER_TARGET: armv7-linux-gnueabihf
  -- CMAKE_FILES_DIRECTORY: /CMakeFiles
  -- CMAKE_HOST_SYSTEM_NAME: Windows
  -- CMAKE_HOST_WIN32: 1
  -- CMAKE_INSTALL_PREFIX: ../install
  -- CMAKE_MAJOR_VERSION: 3
  -- CMAKE_MINOR_VERSION: 10
  -- CMAKE_PATCH_VERSION: 2
  -- CMAKE_ROOT: C:/Program Files/CMake/share/cmake-3.10
  -- CMAKE_SOURCE_DIR: C:/buildbot/temp/build
  -- CMAKE_TWEAK_VERSION: 0
  -- CMAKE_VERSION: 3.10.2

Looks like this is a feature (bug?_ of CMake. CMake doc says

  CMAKE_SOURCE_DIR
  The path to the top level of the source tree.
  
  This is the full path to the top level of the current CMake source tree. For an in-source build, this would be the same as CMAKE_BINARY_DIR.
  
  When run in -P script mode, CMake sets the variables CMAKE_BINARY_DIR, CMAKE_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR to the current working directory.

`-C` could be some kind of the script mode. May be. We use CMake 3.10.2 on the builders.

I think may be it is optimal to use `CMAKE_CURRENT_LIST_DIR` to calculate a direct path to required file. We always know where it is.

Something like that

  get_filename_component(LIBCXX_CXX_ABI_INCLUDE_PATHS
                         "${CMAKE_CURRENT_LIST_DIR}/../../../libcxxabi/include"
                         ABSOLUTE CACHE) 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74347/new/

https://reviews.llvm.org/D74347





More information about the cfe-commits mailing list