c - Macro retrieving from CMake -


i have following code:

#if defined(__win32) || defined(__win64) // windows compiler compiles code #  define windows_platform #elif defined(__linux__) // gcc compiles #  define linux_platform #else #  error "unsupported platform" #endif 

is cmake able check macros windows_platform or linux_platform , set source file path accordingly win/ or posix/ ?

cmake has own variables check if on particular platform. example, using following code can check if on 1 of popular platforms , adjust whatever need accordingly:

if(win32) ... elseif(apple) ... elseif(unix , not apple , not cygwin) ... endif() 

so don't need custom macros there — cmake has such functional built-in.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -