summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorKonstantin Podsvirov <konstantin@podsvirov.pro>2019-10-23 23:37:08 +0300
committerKonstantin Podsvirov <konstantin@podsvirov.pro>2019-10-23 23:56:50 +0300
commit8ca3b21e389fe83fd4eba2655316f4f6b63d9e72 (patch)
tree33d6c0e167a294170188fc0b85b709ed362a377c /CMakeLists.txt
parent5251ba10db1a8f7e05574c2311682cbfb5286317 (diff)
downloadcolm-8ca3b21e389fe83fd4eba2655316f4f6b63d9e72.tar.gz
cmake: restore project
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt37
1 files changed, 37 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 430c7ee4..08a1c069 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,4 +22,41 @@ project(${PROJECT_NAME}
set(${PROJECT_NAME}_MAKE_INSTALL ON CACHE BOOL
"Set to OFF to disable install rules (default is ON)")
+set(${PROJECT_NAME}_BUILD_EXAMPLES OFF CACHE BOOL
+ "Set to ON to build examples (default is OFF)")
+
+# Check type size
+include(CheckTypeSize)
+check_type_size("int" SIZEOF_INT)
+check_type_size("long" SIZEOF_LONG)
+check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)
+check_type_size("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG)
+check_type_size("void *" SIZEOF_VOID_P)
+
+# Check system headers
+include(CheckIncludeFile)
+check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
+check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
+check_include_file(unistd.h HAVE_UNISTD_H)
+
+# Prepare settings
+if("${CMAKE_BUILD_TYPE}" MATCHES "[Dd][Ee][Bb]")
+ set(DEBUG 1)
+endif()
+set(VERSION "${PROJECT_VERSION}")
+set(PUBDATE "${PROJECT_PUBDATE}")
+
+# Common compile definitions
+set(common_COMPILE_DEFINITIONS PREFIX="${CMAKE_INSTALL_PREFIX}")
+
add_subdirectory(src)
+
+add_subdirectory(colm)
+add_library(colm::libcolm ALIAS libcolm)
+add_executable(colm::colm ALIAS colm)
+
+add_subdirectory(ragel)
+
+if(${PROJECT_NAME}_BUILD_EXAMPLES)
+ add_subdirectory(examples)
+endif()