Use
if (WIN32)
# do something
endif (WIN32)
or
if (UNIX)
# do something
endif (UNIX)
or
if (MSVC)
# do something
endif (MSVC)
or similar
see CMake Useful Variables
and CMake Checking Platform
Use
if (WIN32)
# do something
endif (WIN32)
or
if (UNIX)
# do something
endif (UNIX)
or
if (MSVC)
# do something
endif (MSVC)
or similar
see CMake Useful Variables
and CMake Checking Platform