Is CMAKE_SYSTEM_NAME empty?

I try to compile for Linux (with the Eclipse CDT4 generator - Ninja), but when I check ${CMAKE_SYSTEM_NAME} in CMakeLists.txt , all I get is empty.

In what scenarios is this variable used?

Using cmake 3.02 from Debian Testing.

+5
source share
1 answer

You need to place CMAKE_SYSTEM_NAME after project :

 message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}") project(Foo) message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}") 

Result:

 CMAKE_SYSTEM_NAME: -- The C compiler identification is GNU 4.9.1 ... -- Detecting CXX compiler ABI info - done CMAKE_SYSTEM_NAME: Linux 
+6
source

Source: https://habr.com/ru/post/1204952/


All Articles