-
Notifications
You must be signed in to change notification settings - Fork 33
Replace CMAKE_SOURCE_DIR with CMAKE_CURRENT_SOURCE_DIR #220
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
base: master
Are you sure you want to change the base?
Changes from all commits
131ca4a
bfcddb7
f99230e
b8edd6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR) | ||
| if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) | ||
| message(FATAL_ERROR "In-tree builds are not supported. Instead, run:\ncmake . -B build <options> && cmake --build build") | ||
| endif() | ||
|
|
||
|
|
@@ -11,7 +11,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
| set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
|
||
| project(yosys-slang CXX) | ||
| set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) | ||
| set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we want the modules to be overridden; this makes accidental name collisions possible where previously they were not
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need it because the default FindYosys.cmake does not work for me. If you think swapping them could break other projects I will remove it from the PR.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it doesn't work for you then that should be fixed. |
||
|
|
||
| option(BUILD_AS_PLUGIN "Build yosys-slang as a plugin" ON) | ||
| mark_as_advanced(BUILD_AS_PLUGIN) | ||
|
|
@@ -51,7 +51,7 @@ option(FMT_INSTALL OFF) | |
| FetchContent_Declare( | ||
| fmt | ||
| EXCLUDE_FROM_ALL | ||
| SOURCE_DIR ${CMAKE_SOURCE_DIR}/third_party/fmt | ||
| SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/fmt | ||
| ) | ||
|
|
||
| set(SLANG_USE_MIMALLOC OFF) | ||
|
|
||
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.
This doesn't look right to me.
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.
This says that if the CMAKE_BINARY_DIR is the directory of yosys-slang then you cant build. This makes sense because you could have
./top/CMakeLists.txt # user cmake
./top/yosys-slang/CMakeLists.txt # yosys-slang cmake
when in top/yosys-slang/CMakeLists.txt
CMAKE_SOURCE_DIR is set to "./top"
CMAKE_CURRENT_SOURCE_DIR is set to "./top/yosys-slang"
if they set CMAKE_BINARY_DIR to "./top/yosys-slang" and we are comparing CMAKE_SOURCE_DIR then it would allow the build to be "In-tree". Which is not supported according to the fatal error.
Comparing CMAKE_CURRENT_SOURCE_DIR instead the makes the STREQUAL true and calls the FATAL_ERROR stopping the build from being "In-tree".
When CMAKE_SOURCE_DIR is equal to CMAKE_CURRENT_SOURCE_DIR this will have the same behavior as before the change.
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.
I think it should be CMAKE_CURRENT_BINARY_DIR, since we don't support in-tree builds as a subproject either
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.
Great, I'll leave the change in.