kde-playground/kdepimlibs/cmake/modules/CheckTimezone.cmake
2015-04-14 21:49:29 +00:00

35 lines
741 B
CMake

# Discover the type of the timezone variable,
# set HAVE_TIMEZONE if found for config.h
INCLUDE (CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES("
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <unistd.h>
int main() { timezone = 1; return 0;}
"
HAVE_TIMEZONE)
IF (NOT HAVE_TIMEZONE)
# Then it's probably this variant, just to be sure
CHECK_CXX_SOURCE_COMPILES("
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <unistd.h>
int main() { const char *p = timezone(0,0); return 0;}
"
HAVE_BSD_TIMEZONE)
endif()
CHECK_CXX_SOURCE_COMPILES("
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <unistd.h>
int main() { struct tm tm; tm.tm_gmtoff=1; return 0; }
"
HAVE_TM_GMTOFF)