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

Configuration fails specifying GULRAK_SOURCE_DIR on Windows #2420

Closed
hinton-mgi opened this issue Jun 14, 2022 · 6 comments
Closed

Configuration fails specifying GULRAK_SOURCE_DIR on Windows #2420

hinton-mgi opened this issue Jun 14, 2022 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@hinton-mgi
Copy link

Describe the issue
When specifying GULRAK_SOURCE_DIR to cmake, configuration fails. As far as I can tell, this is because Windows file paths are not valid URLs (because '\' is the separator). Modifying gulrak.cmake worked for me:

file(TO_CMAKE_PATH ${GULRAK_SOURCE_DIR} GULRAK_SOURCE_URL)
set(GULRAK_SOURCE_URL "file://${GULRAK_SOURCE_URL}")
FetchContent_Declare(
    ${CONTENT_NAME}
    URL ${GULRAK_SOURCE_URL}
)

I know next to nothing about cmake, perhaps this doesn't always work and/or there is a better way to convert a path to a URL.

@hinton-mgi hinton-mgi added the help wanted Extra attention is needed label Jun 14, 2022
@seando-adsk
Copy link
Collaborator

How are you specifying the path? You can always use / (even on Windows as this is the cmake default).
-DGULRAK_SOURCE_DIR=C:/gulrak

Sean

@hinton-mgi
Copy link
Author

hinton-mgi commented Jun 15, 2022

The path is specified in a batch file, as -DGULRAK_SOURCE_DIR="%~dp0\depends\gulrak-filesystem". Obviously I can do some processing on the path to use forward slashes, but it would be much more natural to support this feature on Windows without gotchas.

@seando-adsk
Copy link
Collaborator

Yes okay I agree with that. But I think this should also work. The FetchContent_Declare URL flag accepts a path and/or URL. So you don't need to add the file:

if(DEFINED GULRAK_SOURCE_DIR)
    file(TO_CMAKE_PATH "${GULRAK_SOURCE_DIR}" GULRAK_SOURCE_DIR)
    FetchContent_Declare(
        ${CONTENT_NAME}
        URL ${GULRAK_SOURCE_DIR}
    )
    ...

Would you be able to submit a pull-request with this fix? You'll need to fill out and sign the CLA if you haven't already done that.

Sean

@hinton-mgi
Copy link
Author

hinton-mgi commented Jun 15, 2022

Great. This also works on my machine. I will look into getting the CLA signed, no promises.

@santosg87
Copy link
Collaborator

@hinton-mgi please let us know if you are able to get the CLA signed and submit that bit. we can test it and close when things are all ready . :)

thank you!

@hinton-mgi
Copy link
Author

Sorry. I have asked my employer to sign the corporate CLA and it's somewhat out of my hands now. Unfortunately it's just not very high priority at the moment. I will post again when it's been handled, but it may take some time.

I am unsure how much my code snippet has tied your hands, legally speaking... but I would be happy to test a fix that someone else authored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
Archived in project
Development

No branches or pull requests

3 participants