summaryrefslogtreecommitdiffhomepage
path: root/cmake/modules/IntrospectSystem.cmake
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-05-23 02:20:13 +0900
committerYukihiro Matsumoto <[email protected]>2012-05-23 02:20:13 +0900
commitdf25301d8081b9351d8a2a9910c2f1d36de3f134 (patch)
tree4f9cb83bab56b02a41a6139c8d23d7b071529845 /cmake/modules/IntrospectSystem.cmake
parentf44acf7bf87c8f4ad258a41bb7884c1f09a8aab9 (diff)
parent0dc183b8f473e1398b1aeada9a39d96ad4d81518 (diff)
downloadmruby-df25301d8081b9351d8a2a9910c2f1d36de3f134.tar.gz
mruby-df25301d8081b9351d8a2a9910c2f1d36de3f134.zip
Merge branch 'master' of github.com:mruby/mruby
Diffstat (limited to 'cmake/modules/IntrospectSystem.cmake')
-rw-r--r--cmake/modules/IntrospectSystem.cmake52
1 files changed, 52 insertions, 0 deletions
diff --git a/cmake/modules/IntrospectSystem.cmake b/cmake/modules/IntrospectSystem.cmake
new file mode 100644
index 000000000..e148563fa
--- /dev/null
+++ b/cmake/modules/IntrospectSystem.cmake
@@ -0,0 +1,52 @@
+# system capabilities checking
+
+# initial system defaults
+if(CMAKE_COMPILER_IS_GNUCC)
+ set(MRUBY_DEFAULT_CFLAGS "-Wall -Werror-implicit-function-declaration")
+ set(CMAKE_C_FLAGS "${MRUBY_DEFAULT_CFLAGS}")
+ set(CMAKE_C_FLAGS_DEBUG "-O3 -ggdb")
+ set(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
+ set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g")
+ set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
+
+ set(MRUBY_LIBS m)
+else()
+ if(MSVC)
+ # TODO default MSVC flags
+ add_definitions(
+ -D_CRT_SECURE_NO_WARNINGS
+ -wd4018 # suppress 'signed/unsigned mismatch'
+ )
+ endif()
+endif()
+
+if(MSVC)
+ add_definitions(
+ -DRUBY_EXPORT # required by oniguruma.h
+ )
+endif()
+
+
+# include helpers
+include(CheckIncludeFile)
+include(CheckSymbolExists)
+
+# header checks
+CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
+if(HAVE_STRING_H)
+ add_definitions(-DHAVE_STRING_H)
+endif()
+
+CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
+if(HAVE_FLOAT_H)
+ add_definitions(-DHAVE_FLOAT_H)
+endif()
+
+
+# symbol checks
+CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
+if(NOT HAVE_GETTIMEOFDAY)
+ add_definitions(-DNO_GETTIMEOFDAY)
+endif()
+
+# vim: ts=2 sts=2 sw=2 et