Skip to content

[Build System: CMake] Add CMake module paths before importing in StandaloneOverlay.cmake #24706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions cmake/modules/StandaloneOverlay.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ if(DEFINED SWIFT_MASTER_LOADED
endif()


list(APPEND CMAKE_MODULE_PATH
"${SWIFT_SOURCE_ROOT}/llvm/cmake/modules"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no guarantee that SWIFT_SOURCE_ROOT is defined. I think it might be better to rely on the standard behaviour of CMake:

find_package(LLVM CONFIG REQUIRED)

That will error out if the user does not specify LLVM_DIR or does not have LLVM installed and available on the system.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all cases where this module is currently used it should be safe to assume that SWIFT_SOURCE_ROOT is defined. I hope to remove the need for this extra system in the near future (should it be possible) then we won't have to worry about this odd inconsistency.

"${PROJECT_SOURCE_DIR}/../../../../cmake/modules"
"${PROJECT_SOURCE_DIR}/../../../cmake/modules")


# -----------------------------------------------------------------------------
# Preconditions

Expand Down Expand Up @@ -69,11 +75,6 @@ set_property(CACHE SWIFT_STDLIB_BUILD_TYPE PROPERTY
set(CMAKE_INSTALL_PREFIX
"${SWIFT_DEST_ROOT}${TOOLCHAIN_DIR}/usr")

list(APPEND CMAKE_MODULE_PATH
"${SWIFT_SOURCE_ROOT}/llvm/cmake/modules"
"${PROJECT_SOURCE_DIR}/../../../../cmake/modules"
"${PROJECT_SOURCE_DIR}/../../../cmake/modules")


set(SWIFT_APPLE_PLATFORMS
OSX IOS IOS_SIMULATOR TVOS TVOS_SIMULATOR WATCHOS WATCHOS_SIMULATOR)
Expand Down