Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine host operating system when cross-compiling with CMake?

Tags:

cmake

I'm developing for embedded system using custom toolchain file. CMAKE_SYSTEM_NAME is set to "Generic", so WIN32, UNIX, etc. variables can't be used to check operating system on which project is configured. But I need to configure project differently on different OS.

How can I determine the operating system where cmake is executed?

like image 205
DikobrAz Avatar asked Jul 12 '13 07:07

DikobrAz


1 Answers

Check the variables that describe the system.

Of particular interest is the CMAKE_HOST_SYSTEM variable and its relatives. Unfortunately, the exact behavior of these is largely dependent on the used platform and toolchain. If you don't get sensible values for your environment, consider writing to the CMake mailing list to request better support for your platform.

like image 139
ComicSansMS Avatar answered Oct 20 '22 15:10

ComicSansMS