0

I want to #define LINUX in my script using CMake. Below is just a workaround.

IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
    add_definitions( -D__LINUX__ )
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

I wonder what is the proper way to do.

Vertexwahn
  • 7,709
  • 6
  • 64
  • 90
eli chan
  • 21
  • 3
  • 5
    This is probably a bad idea. Identifiers containing `__` anywhere are reserved for the compiler's internal use. – MSalters Jul 22 '19 at 09:30
  • Possible duplicate of [Define preprocessor macro through CMake](https://stackoverflow.com/q/9017573/608639) – jww Jul 22 '19 at 17:11

0 Answers0