-
Notifications
You must be signed in to change notification settings - Fork 256
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
build: enable building for Fedora40 and Ubuntu 24.04 #1815
base: master
Are you sure you want to change the base?
Conversation
1957240
to
6f21422
Compare
354bf6b
to
197747a
Compare
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 have a few remarks concerning the CPM integration. But overall this looks good!
set(FETCHCONTENT_FULLY_DISCONNECTED CACHE STRING "OFF" FORCE) | ||
mark_as_advanced(FETCHCONTENT_FULLY_DISCONNECTED) |
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 guess it is sufficient to simply check if this was set and then force local packages only.
That way everybody can build in fully disconnected mode, but things will fail in a nice way (i.e. find_package()
should throw an error).
In the meantime we will need to manually turn off FETCHCONTENT_FULLY_DISCONNECTED
for some of the package managers.
set(FETCHCONTENT_FULLY_DISCONNECTED CACHE STRING "OFF" FORCE) | |
mark_as_advanced(FETCHCONTENT_FULLY_DISCONNECTED) | |
if(FETCHCONTENT_FULLY_DISCONNECTED) | |
message(WARNING "Detected FETCHCONTENT_FULLY_DISCONNECTED.") | |
message(WARNING "As this will break fetching, only local packages will be considered!") | |
set(CPM_LOCAL_PACKAGES_ONLY ON) | |
endif() |
However, this section should be moved after the include(CPM) so that CMake already knows CPM_LOCAL_PACKAGES_ONLY
is an option.
As an alternative we could also decide to just fail with a bad combination of parameters:
if(FETCHCONTENT_FULLY_DISCONNECTED AND NOT CPM_LOCAL_PACKAGES_ONLY)
message(FATAL_ERROR "When FETCHCONTENT_FULLY_DISCONNECTED is enabled, CPM_LOCAL_PACKAGES_ONLY must be enabled, too!")
endif()
if(PS) | ||
set(PSCMD ${PS}) | ||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
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.
if(PS) | |
set(PSCMD ${PS}) | |
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") | |
set(PSCMD ${PS}) | |
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
(adapt following lines, too)
@@ -24,12 +24,10 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") | |||
set(AWK ${GAWK}) | |||
endif() | |||
|
|||
# ps is required for systemtests |
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 should go before find_program(PS)
.
|
||
find_program(PS ps) | ||
find_program(PS ps REQUIRED) |
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.
If ps
is optional for the build, but required for systemtests, it may make sense to leave this file as is, but to add find_program(PS ps REQUIRED)
to systemtests/CMakeLists.txt
so it is only actually required to build systemtests (i.e. not when building MacOS or a ULC).
CMake will not search the program twice, so it won't hurt.
@@ -38,7 +40,8 @@ include(BareosVersionFromGit) | |||
include(BareosExtractVersionInfo) | |||
include(BareosGetDistInfo) | |||
include(RemoveNDebugFlag) | |||
|
|||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | |||
include(CPM) |
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.
we might want to unconditionally enable CPM_USE_LOCAL_PACKAGES
so find_package()
is always tried first:
include(CPM) | |
include(CPM) | |
set(CPM_USE_LOCAL_PACKAGES ON) |
@@ -35,7 +35,7 @@ if(USE_SYSTEM_FMT) | |||
set_target_properties(fmt::fmt PROPERTIES IMPORTED_GLOBAL TRUE) | |||
message(STATUS "Using system fmt ${fmt_VERSION}") | |||
else() | |||
add_subdirectory(fmt EXCLUDE_FROM_ALL) | |||
CPMAddPackage("gh:fmtlib/fmt#10.2.1") |
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 add the package like this:
CPMAddPackage("gh:fmtlib/fmt#10.2.1") | |
CPMAddPackage( | |
NAME fmt | |
VERSION 6.2.1 | |
GITUB_REPOSITORY "fmtlib/fmt" | |
GIT_TAG "10.2.1" | |
EXCLUDE_FROM_ALL | |
) |
This will select any local version 6.2.1 or newer, if it exists, and will download and use 10.2.1 from GitHub otherwise.
However, the CMake-code for that should be in the toplevel CMakeLists.txt. Considering the amount of things we're probably going to add here, it may make sense to create an individual file and include()
that from the toplevel CMakeLists.txt.
Thank you for contributing to the Bareos Project!
Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
Make sure you check/merge the PR using
devtools/pr-tool
to have some simple automated checks run and a proper changelog record added.General
Source code quality
Tests