summaryrefslogtreecommitdiff
path: root/include/AddScgBits.cmake
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2012-12-31 05:04:42 +0400
committerIgor Pashev <pashev.igor@gmail.com>2012-12-31 05:04:42 +0400
commit71dc8760ff4de5f365330d1bc571d934deb54af9 (patch)
tree7346d42a282562a3937d82307012b5857d642ce6 /include/AddScgBits.cmake
downloadcdrkit-71dc8760ff4de5f365330d1bc571d934deb54af9.tar.gz
Imported Upstream version 1.1.11upstream/1.1.11upstream
Diffstat (limited to 'include/AddScgBits.cmake')
-rw-r--r--include/AddScgBits.cmake65
1 files changed, 65 insertions, 0 deletions
diff --git a/include/AddScgBits.cmake b/include/AddScgBits.cmake
new file mode 100644
index 0000000..6aaff73
--- /dev/null
+++ b/include/AddScgBits.cmake
@@ -0,0 +1,65 @@
+
+IF(NOT GUARD_SCGCONFIG)
+ SET(GUARD_SCGCONFIG 1)
+
+
+LIST(APPEND EXTRA_LIBS "usal")
+
+INCLUDE(CheckIncludeFiles)
+CHECK_INCLUDE_FILES("stdio.h;camlib.h" HAVE_CAMLIB_H)
+
+IF(HAVE_CAMLIB_H)
+
+ # quick an dirty, should better become a variable used by libusal only,
+ # analogous to SCG_SELF_LIBS
+ ADD_DEFINITIONS(-DHAVE_CAMLIB_H)
+
+ LIST(APPEND EXTRA_LIBS "cam")
+ LIST(APPEND SCG_SELF_LIBS "cam")
+
+ENDIF(HAVE_CAMLIB_H)
+
+FIND_LIBRARY(HAVE_LIBVOLMGT "volmgt")
+IF(HAVE_LIBVOLMGT)
+ LIST(APPEND EXTRA_LIBS "volmgt")
+ LIST(APPEND SCG_SELF_LIBS "volmgt")
+ENDIF(HAVE_LIBVOLMGT)
+
+ INCLUDE(CheckCSourceCompiles)
+
+ SET(TESTSRC "
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int main(int argc, char **argv) {
+ return socket(AF_INET, SOCK_STREAM, 0);
+}
+")
+
+SET(CMAKE_REQUIRED_LIBRARIES )
+ CHECK_C_SOURCE_COMPILES("${TESTSRC}" LIBC_SOCKET)
+
+IF(NOT LIBC_SOCKET)
+ LIST(APPEND EXTRA_LIBS -lsocket)
+ #MESSAGE("Using libsocket for socket functions")
+ENDIF(NOT LIBC_SOCKET)
+
+
+ SET(TESTSRC "
+#include <sched.h>
+struct sched_param scp;
+ int main(int argc, char **argv) {
+ return sched_setscheduler(0, SCHED_RR, &scp);
+ }
+")
+
+
+SET(CMAKE_REQUIRED_LIBRARIES )
+ CHECK_C_SOURCE_COMPILES("${TESTSRC}" LIBC_SCHED)
+
+IF(NOT LIBC_SCHED)
+ LIST(APPEND EXTRA_LIBS -lrt)
+ #MESSAGE("Using librt for realtime functions")
+ENDIF(NOT LIBC_SCHED)
+
+ENDIF(NOT GUARD_SCGCONFIG)