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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -