Fwd: CMAKE_HOST_SYSTEM_NAME is empty

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: CMAKE_HOST_SYSTEM_NAME is empty

Orban, Laszlo
Hi all,

Please help me an issue I'm facing with CMAKE_HOST_SYSTEM_NAME on FreeBSD 10.3. It gives back empty string, if I read it before the 'project(...)'.
As far as I understood, CMAKE_SYSTEM_NAME can be used only after the 'project(...)' call, but CMAKE_HOST_SYSTEM_NAME should simply give back the result of 'uname -s' and could be used before 'project'.
I'd like to use CMAKE_HOST_SYSTEM_NAME in my Compilers module to switch to clang instead of gcc in case if the host system is FreeBSD.

CMakeLists.txt:
...
include(Version)
include(BuildType)
include(Compilers)
message ( "!Before project='${CMAKE_HOST_SYSTEM_NAME}'" )
project ( WanderfulProject LANGUAGES C )
message ( "!After project='${CMAKE_HOST_SYSTEM_NAME}'" )
include(Endianness)
include(GNUInstallDirs)
include(Configure)
...

Output:
...
!Before project=''
-- The C compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
!After project='FreeBSD'
...

Additional info:
$ cmake --version
cmake version 3.4.1
$ uname -K
1003000
$ uname -s
FreeBSD
$ uname -m
amd64

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: CMAKE_HOST_SYSTEM_NAME is empty

CMake mailing list
Hello,

On 25.04.19 09:29, Orban, Laszlo wrote:
> Please help me an issue I'm facing with CMAKE_HOST_SYSTEM_NAME on
> FreeBSD 10.3. It gives back empty string, if I read it before the
> 'project(...)'.
> As far as I understood, CMAKE_SYSTEM_NAME can be used only after the
> 'project(...)' call, but CMAKE_HOST_SYSTEM_NAME should simply give back
 >
> Additional info:
>
>     $ cmake --version
>     cmake version 3.4.1

In CMake 3.9.0 and later I made CMAKE_HOST_SYSTEM_NAME available in
scritping context (which should also make it available prior to a
project() call).

Change:
https://gitlab.kitware.com/cmake/cmake/merge_requests/499

Could you please re-try with latest CMake?

Thanks,
Gregor

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: CMAKE_HOST_SYSTEM_NAME is empty

Orban, Laszlo
Hi Gregor,

I Installed cmake version 3.12.2 and I can confirm that it works, CMAKE_HOST_SYSTEM_NAME is available before the project() call
Thank you very much for your assistance!

Laszlo

On Sun, Apr 28, 2019 at 9:54 PM Gregor Jasny <[hidden email]> wrote:
Hello,

On 25.04.19 09:29, Orban, Laszlo wrote:
> Please help me an issue I'm facing with CMAKE_HOST_SYSTEM_NAME on
> FreeBSD 10.3. It gives back empty string, if I read it before the
> 'project(...)'.
> As far as I understood, CMAKE_SYSTEM_NAME can be used only after the
> 'project(...)' call, but CMAKE_HOST_SYSTEM_NAME should simply give back
 >
> Additional info:
>
>     $ cmake --version
>     cmake version 3.4.1

In CMake 3.9.0 and later I made CMAKE_HOST_SYSTEM_NAME available in
scritping context (which should also make it available prior to a
project() call).

Change:
https://gitlab.kitware.com/cmake/cmake/merge_requests/499

Could you please re-try with latest CMake?

Thanks,
Gregor


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake