support/cmake: Explicitly set CMAKE_SYSTEM
PATCH 1/1 support/cmake: Explicitly set CMAKE_SYSTEM
Some packages test for CMAKE_SYSTEM explicitly.[1]
CMAKE_SYSTEM is comprised of CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_VERSION. It defaults to CMAKE_SYSTEM_NAME if CMAKE_SYSTEM_VERSION is not set.[2]
At the point CMAKE_SYSTEM_NAME is set to "Linux" CMAKE_SYSTEM is already constructed. Setting it explicitly ensures that it is the correct value.
[1] Fluidsynth https://github.com/FluidSynth/fluidsynth/blob/0cd44d00e1ec9a905d51163efde7b70ff8ae0ba3/CMakeLists.txt#L80
[2] https://cmake.org/cmake/help/git-master/variable/CMAKE_SYSTEM.html#variable:CMAKE_SYSTEM
--- support/misc/Buildroot.cmake | 1 + 1 file changed, 1 insertion(+)
support/misc/Buildroot.cmake +1 -0
@@ -1,5 +1,6 @@ # Impersonate a Linux system. Afterall, that's what we are... set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM ${CMAKE_SYSTEM_NAME}) include(Platform/Linux) # Override problematic settings, to avoid RPATH against host lib directories.
Signature · 1 line
2.19.1
PATCH 1/1 support/cmake: Explicitly set CMAKE_SYSTEM
Franck, All,
Thanks for your contribution. I was finally able to wrap my head around this cmake stuff... ;-)
On 2019-03-17 17:48 +0100, Frank Vanbever spake thusly:
Quoted 7 lines
Some packages test for
CMAKE_SYSTEMexplicitly.[1]
CMAKE_SYSTEMis comprised ofCMAKE_SYSTEM_NAMEandCMAKE_SYSTEM_VERSION. It defaults toCMAKE_SYSTEM_NAMEifCMAKE_SYSTEM_VERSIONis not set.[2]At the point
CMAKE_SYSTEM_NAMEis set to "Linux"CMAKE_SYSTEMis already constructed. Setting it explicitly ensures that it is the correct value.
This is because we do set CMAKE_SYSTEM_NAME twice, in fact:
- first in toolchainfile.cmake, so that we tell cmake to use the "Buildroot" platform,
- second, in the Buildroot.cmake platform definition itself, so that we eventually behave like the Linux platform.
I haven't been able to really track down exacty _when_ CMAKE_SYSTEM is indeed set, but I believe it is done after the toolchainfile.cmake file is parsed, but before the Buildroot.cmake platofrm one is. And indeed, that becomes too late.
So, I believe this change is correct, but...
We also set CMAKE_SYSTEM_VERSION to 1, and so the real CMAKE_SYSTEM value should be set to Linux-1 if we were to follow the documentation to the letter.
However, for Linux, the version does not matter, and in some situations may even be harmful (that was reported in one of the commits that introduce Buildroot.cmake andtoolchanfile.cmake).
So:
Regards,
Yann E. MORIN.
Quoted 26 lines
[1] Fluidsynth https://github.com/FluidSynth/fluidsynth/blob/0cd44d00e1ec9a905d51163efde7b70ff8ae0ba3/CMakeLists.txt#L80
[2] https://cmake.org/cmake/help/git-master/variable/CMAKE_SYSTEM.html#variable:CMAKE_SYSTEMSigned-off-by Frank Vanbever <[email protected]>--- support/misc/Buildroot.cmake | 1 + 1 file changed, 1 insertion(+)support/misc/Buildroot.cmake +1
-0@@ -1,5 +1,6 @@ # Impersonate a Linux system. Afterall, that's what we are... set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM ${CMAKE_SYSTEM_NAME}) include(Platform/Linux) # Override problematic settings, to avoid RPATH against host lib directories.Signature · 6 lines
2.19.1 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 support/cmake: Explicitly set CMAKE_SYSTEM
Quoted 34 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Franck, All,
Thanks for your contribution. I was finally able to wrap my head around this cmake stuff... ;-)On 2019-03-17 17:48 +0100, Frank Vanbever spake thusly:
Quoted 7 lines
Some packages test for
CMAKE_SYSTEMexplicitly.[1]
CMAKE_SYSTEMis comprised ofCMAKE_SYSTEM_NAMEandCMAKE_SYSTEM_VERSION. It defaults toCMAKE_SYSTEM_NAMEifCMAKE_SYSTEM_VERSIONis not set.[2]At the point
CMAKE_SYSTEM_NAMEis set to "Linux"CMAKE_SYSTEMis already constructed. Setting it explicitly ensures that it is the correct value.This is because we do set
CMAKE_SYSTEM_NAMEtwice, in fact:- first in toolchainfile.cmake, so that we tell cmake to use the "Buildroot" platform,
- second, in the Buildroot.cmake platform definition itself, so that we eventually behave like the Linux platform.
I haven't been able to really track down exacty _when_
CMAKE_SYSTEMis indeed set, but I believe it is done after the toolchainfile.cmake file is parsed, but before the Buildroot.cmake platofrm one is. And indeed, that becomes too late.So, I believe this change is correct, but...
We also set
CMAKE_SYSTEM_VERSIONto 1, and so the realCMAKE_SYSTEMvalue should be set to Linux-1 if we were to follow the documentation to the letter.
Quoted 7 lines
However, for Linux, the version does not matter, and in some situations may even be harmful (that was reported in one of the commits that introduce Buildroot.cmake andtoolchanfile.cmake).
So:
Acked-by Yann E. MORIN <[email protected]>
Thanks.
Committed after updating the commit message with the above description from Yann, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 support/cmake: Explicitly set CMAKE_SYSTEM
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Korsgaard <[email protected]> writes:
Hi,
Quoted 32 lines
Quoted 31 lines
On 2019-03-17 17:48 +0100, Frank Vanbever spake thusly:
Quoted 7 lines
Some packages test for
CMAKE_SYSTEMexplicitly.[1]
CMAKE_SYSTEMis comprised ofCMAKE_SYSTEM_NAMEandCMAKE_SYSTEM_VERSION. It defaults toCMAKE_SYSTEM_NAMEifCMAKE_SYSTEM_VERSIONis not set.[2]At the point
CMAKE_SYSTEM_NAMEis set to "Linux"CMAKE_SYSTEMis already constructed. Setting it explicitly ensures that it is the correct value.This is because we do set
CMAKE_SYSTEM_NAMEtwice, in fact:- first in toolchainfile.cmake, so that we tell cmake to use the "Buildroot" platform,
- second, in the Buildroot.cmake platform definition itself, so that we eventually behave like the Linux platform.
I haven't been able to really track down exacty _when_
CMAKE_SYSTEMis indeed set, but I believe it is done after the toolchainfile.cmake file is parsed, but before the Buildroot.cmake platofrm one is. And indeed, that becomes too late.So, I believe this change is correct, but...
We also set
CMAKE_SYSTEM_VERSIONto 1, and so the realCMAKE_SYSTEMvalue should be set to Linux-1 if we were to follow the documentation to the letter.However, for Linux, the version does not matter, and in some situations may even be harmful (that was reported in one of the commits that introduce Buildroot.cmake andtoolchanfile.cmake).
Quoted 8 lines
Quoted 3 lines
So:
Acked-by Yann E. MORIN <[email protected]>Thanks.
Committed after updating the commit message with the above description from Yann, thanks.
Committed to 2019.02.x and 2019.05.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard