-
Notifications
You must be signed in to change notification settings - Fork 471
build: support embedding in other CMake projects #382
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
Conversation
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.
This really is functionally equivalent. No real strong feelings on this. Up to @MadCoder or @millenomi |
@swift-ci test |
@@ -1,7 +1,7 @@ | |||
|
|||
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") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
build: support embedding in other CMake projects Signed-off-by: Kim Topley <[email protected]>
Allow libdispatch to be embedded in other CMake projects using
add_subdirectory(). This essentially means that
CMAKE_SOURCE_DIR
andCMAKE_BINARY_DIR
cannot be used directly. Use the versions of these variableswhich are scoped to the current project or directory.