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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With