Skip to content

Conversation

@adierking
Copy link
Contributor

Allow libdispatch to be embedded in other CMake projects using
add_subdirectory(). This essentially means that CMAKE_SOURCE_DIR and
CMAKE_BINARY_DIR cannot be used directly. Use the versions of these variables
which are scoped to the current project or directory.

@adierking
Copy link
Contributor Author

cc @MadCoder @compnerd

Allow libdispatch to be embedded in other CMake projects using
add_subdirectory(). This essentially means that `CMAKE_SOURCE_DIR` and
`CMAKE_BINARY_DIR` cannot be used directly. Use the versions of these variables
which are scoped to the current project or directory.
@compnerd
Copy link
Member

This really is functionally equivalent. No real strong feelings on this. Up to @MadCoder or @millenomi

@tkremenek
Copy link
Member

@swift-ci test

@ktopley-apple ktopley-apple self-requested a review August 20, 2018 14:33
cmake_minimum_required(VERSION 3.4.3)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this CMAKE_CURRENT_SOURCE_DIR and not PROJECT_SOURCE_DIR like everywhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The PROJECT_* variables are set by the project() command, which is called below this, so they aren't available yet. I assume that the module path is intentionally set before calling project() because it could allow for defining custom platform/toolchain modules that get picked up by the command.

Copy link
Contributor

@ktopley-apple ktopley-apple left a comment

Choose a reason for hiding this comment

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

Reviewed with one comment.

@ktopley-apple ktopley-apple merged commit ba74b6a into swiftlang:master Aug 20, 2018
@adierking adierking deleted the cmake branch December 2, 2018 00:33
ktopley-apple added a commit that referenced this pull request Dec 6, 2018
build: support embedding in other CMake projects
Signed-off-by: Kim Topley <ktopley@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants