-
Notifications
You must be signed in to change notification settings - Fork 22
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
[WIP] Make Linux compilation more comfortable #157
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -295,8 +295,7 @@ if(BUILD_AVDECC_LIB_SHARED_CXX) | |
|
||
# Setup libfmt | ||
if(ENABLE_AVDECC_USE_FMTLIB) | ||
target_compile_options(${PROJECT_NAME}_cxx PRIVATE -DHAVE_FMT) | ||
target_link_libraries(${PROJECT_NAME}_cxx PRIVATE fmt-header-only) | ||
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 understand how that change would work better than using the fmt author provided header-only target. Linking with it guarantees everything is correctly setup by the author. I actually don't see how it can work without specifying the location of the header file. I suspect it would fall in a working state because cmake automatically adds the fetched content as a "-I" path. But if the author then decides to change the internal define (ie. FMT_HEADER_ONLY) or add a new one, it will not be passed to the compilation units if not using the defined target. 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. Oh, it failed to find fmt-header-only and somehow I didn't find it upstream either. I probably was too tired. It looks like I just have to change fmt-header-only to fmt::fmt-header-only. I'll change that. |
||
target_compile_options(${PROJECT_NAME}_cxx PRIVATE -DHAVE_FMT -DFMT_HEADER_ONLY) | ||
endif() | ||
|
||
# Setup json | ||
|
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.
Based on the documentation, when using FIND_PACKAGE_ARGS, CMake will first try to find the library using find_package which is not something desired. If a newer (or older) version is installed somewhere on the system, it will be used instead of the one explicitly defined and validated by the project. Not a controlled environment.
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.
You can still disable this behavior with FETCHCONTENT_TRY_FIND_PACKAGE_MODE in your controlled environment. But I don't have your controlled environment and avdecc just doesn't compile for me because fmt is outdated. When I want to get Hive into Fedora I'm not allowed to bundle every dependency. Dependencies -- even static libraries -- need to be tracked and there is always only one version in the repositories.
I think the best approach to get what most people expect is to set FETCHCONTENT_TRY_FIND_PACKAGE_MODE to NEVER on macOS and Windows. On Linux everybody expects build systems to get their dependencies from the system. If you build an application with Flatpak it would automatically use FetchContent because the dependencies are missing. So it would work out-of-the-box.