Skip to content
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

Replacing in-built sio with FetchContent mechanism #181

Merged
merged 5 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,18 @@ FIND_PACKAGE( SIO QUIET )

IF( NOT SIO_FOUND )
MESSAGE( STATUS "SIO not found on your system. Using builtin sio" )
ADD_SUBDIRECTORY( sio )
include(FetchContent)
FetchContent_Declare(sio_extern
GIT_REPOSITORY https://github.com/iLCSoft/SIO.git
GIT_TAG v00-01
GIT_SHALLOW 1
# FIND_PACKAGE_ARGS
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
)
)
get_target_property(SIO_VERSION SIO::sio VERSION)
get_target_property(SIO_INCLUDE_DIRS SIO::sio INCLUDE_DIRECTORIES)

Just saw that these are use in a print out just here below and with FetchContent they are empty. This should hopefully also fix the ROOT dictionary issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, sorry for delay, got only now around to it. Workaround works; I had previously not generated the rootDicts so I did not see the problem. It naturally is independent of the version. For the moment it should be okay but using root_generate_dictionary from the modern root cmake instead of the self made macros in MacroRootDict.cmake, the relevant target and MODULE option is I guess the way to go:
https://cliutils.gitlab.io/modern-cmake/chapters/packages/ROOT.html
root-project/root#8308

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries. Thanks for putting in the work :)

Yeah, switching to a more modern approach here has been on my list for quite some time, but haven't yet had time to come around to that.


FetchContent_MakeAvailable(sio_extern)

get_target_property(SIO_VERSION SIO::sio VERSION)
get_target_property(SIO_INCLUDE_DIRS SIO::sio INCLUDE_DIRECTORIES)
ENDIF()

MESSAGE( STATUS "Using SIO (${SIO_VERSION})" )
Expand Down Expand Up @@ -320,10 +331,3 @@ install(EXPORT ${PROJECT_NAME}Targets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/"
)

IF( NOT SIO_FOUND )
install(EXPORT SIOTargets
NAMESPACE SIO::
FILE "SIOTargets.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/SIO/"
)
ENDIF()
50 changes: 0 additions & 50 deletions sio/CMakeLists.txt

This file was deleted.

Loading