aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-02-28 19:53:23 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2015-02-28 19:53:23 +0100
commit087645848baec5e59e4296817850bd5dd240cbb2 (patch)
treef5b3d507c4a65a95a26a52a17136fdf94811b785 /CMakeLists.txt
downloadliberty-087645848baec5e59e4296817850bd5dd240cbb2.tar.gz
liberty-087645848baec5e59e4296817850bd5dd240cbb2.tar.xz
liberty-087645848baec5e59e4296817850bd5dd240cbb2.zip
Initial commit
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..75ef930
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,34 @@
+project (liberty C)
+cmake_minimum_required (VERSION 2.8.5)
+
+# Moar warnings
+if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
+ # -Wunused-function is pretty annoying here, as everything is static
+ set (CMAKE_C_FLAGS "-std=c99 -Wall -Wextra -Wno-unused-function")
+endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
+
+# Dependencies
+find_package (PkgConfig REQUIRED)
+pkg_check_modules (libssl REQUIRED libssl libcrypto)
+
+# -lpthread is only there for debugging (gdb & errno)
+# -lrt is only for glibc < 2.17
+set (common_libraries ${libssl_LIBRARIES} rt pthread)
+include_directories (${libssl_INCLUDE_DIRS})
+link_directories (${libssl_LIBRARY_DIRS})
+
+# Generate a configuration file
+# TODO: actualy use the configuration file for something; so far we allow
+# for direct inclusion without running this CMakeLists.txt
+configure_file (${PROJECT_SOURCE_DIR}/liberty-config.h.in
+ ${PROJECT_BINARY_DIR}/liberty-config.h)
+include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
+set (common_sources ${PROJECT_BINARY_DIR}/liberty-config.h)
+
+# Build some unit tests
+enable_testing ()
+foreach (name liberty)
+ add_executable (test-${name} tests/${name}.c ${common_sources})
+ target_link_libraries (test-${name} ${common_libraries})
+ add_test (test-${name} test-${name})
+endforeach (name)