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

Fix cross-compilation detection #1316

Merged
merged 1 commit into from Mar 12, 2019

Conversation

Projects
None yet
2 participants
@seanwarren
Copy link
Contributor

commented Mar 11, 2019

Currently, cross compilation detection requires that the variable CMAKE_CROSSCOMPILING in the consuming project be an exact string match for that during compilation. This can cause a problem if there is a mismatch (for example if CMAKE_CROSSCOMPILING is set to FALSE in the consuming project rather than OFF).

This can cause a find_project(PROJ4 ...) call to fail erroneously when using the config file.

This PR fixes this issue by converting a boolean evaluation to ON or OFF.

While this seems like a bit of an estoric edge case, this situation occurs when using vcpkg to build and consume proj4.

@kbevers

This comment has been minimized.

Copy link
Member

commented Mar 11, 2019

I am not a CMake expert in any way, so please bear with me. Isn't it the consuming projects problem if it isn't setting CMake variables properly? Or is this just another one of CMake's quirks that makes things harder than they need to be?

In any case I guess we better merge this if problems can be fixed by it. @mloskot do you have an opinion on this?

@seanwarren

This comment has been minimized.

Copy link
Contributor Author

commented Mar 11, 2019

@kbevers, I think the issue is that CMAKE_CROSSCOMPILING should be treated as a boolean and not string value so FALSE is equivalent to OFF (so, yes, it is one of those CMake quirks!). In fact some of CMakes internal tests set this variable to TRUE/FALSE rather than ON/OFF.

However as this is pretty obscure case I can equally submit this as a patch to vcpkg if you'd prefer.

@kbevers

This comment has been minimized.

Copy link
Member

commented Mar 11, 2019

In fact some of CMakes internal tests set this variable to TRUE/FALSE rather than ON/OFF.

Well, if CMake itself can't even make up its mind I think we have to use your work around

However as this is pretty obscure case I can equally submit this as a patch to vcpkg if you'd prefer.

That seems like the correct thing to do, but it will take a few release cycles before that can be relied on, so applying the fix in both places is probably the safer option for now.

@kbevers kbevers merged commit 5dc01e9 into OSGeo:master Mar 12, 2019

3 checks passed

Travis CI - Pull Request Build Passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
coverage/coveralls Coverage remained the same at 85.275%
Details

@kbevers kbevers added this to the 6.0.1 milestone Mar 12, 2019

@kbevers

This comment has been minimized.

Copy link
Member

commented Mar 12, 2019

Thanks @seanwarren!

@seanwarren

This comment has been minimized.

Copy link
Contributor Author

commented Mar 15, 2019

Great, thanks for the quick merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.