Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeder Andersen2012-03-14 21:22:08 +0000
committerEugene Tarassov2012-03-15 19:11:17 +0000
commite642148dae8dd3f93c1fe0949e8e2bf225fcdc36 (patch)
tree62d2f4903ba9e6132616d23cd46fb1b082c7b6d1 /cmake-tcf-lib.txt
parentaeb7c770dbc636d77c43532a533b06b9af796888 (diff)
downloadorg.eclipse.tcf.agent-e642148dae8dd3f93c1fe0949e8e2bf225fcdc36.tar.gz
org.eclipse.tcf.agent-e642148dae8dd3f93c1fe0949e8e2bf225fcdc36.tar.xz
org.eclipse.tcf.agent-e642148dae8dd3f93c1fe0949e8e2bf225fcdc36.zip
cmake: added support for building as external lib
This fixes current cmake build support, and further decouples the necessary logic so the TCF core can be sanely included in larger cmake-based projects.
Diffstat (limited to 'cmake-tcf-lib.txt')
-rw-r--r--cmake-tcf-lib.txt73
1 files changed, 73 insertions, 0 deletions
diff --git a/cmake-tcf-lib.txt b/cmake-tcf-lib.txt
new file mode 100644
index 00000000..3c80c859
--- /dev/null
+++ b/cmake-tcf-lib.txt
@@ -0,0 +1,73 @@
+# -*- cmake -*-
+
+if (WIN32)
+if(NOT TCF_OPSYS)
+ set(TCF_OPSYS "Windows")
+endif()
+if(NOT TCF_MACHINE)
+ set(TCF_MACHINE "x86_64")
+endif()
+endif (WIN32)
+
+set(TCF_BASE_DIR ${TCF_DIR}/agent)
+
+# sources to build
+set(TCF_SRCS)
+
+# get all regular source files
+file(GLOB TCF_SRCS_REL RELATIVE ${TCF_BASE_DIR}
+ ${TCF_BASE_DIR}/system/${TCF_OPSYS}/tcf/*.c
+ ${TCF_BASE_DIR}/machine/${TCF_MACHINE}/tcf/*.c
+ ${TCF_BASE_DIR}/tcf/framework/*.c
+ ${TCF_BASE_DIR}/tcf/services/*.c
+ ${TCF_BASE_DIR}/tcf/main/*.c)
+
+# remove non-library files
+file(GLOB TCF_MAIN_REL RELATIVE ${TCF_BASE_DIR}
+ ${TCF_BASE_DIR}/tcf/main/main*.c)
+list(REMOVE_ITEM TCF_SRCS_REL ${TCF_MAIN_REL})
+
+if(DEFINED TCF_EXTRA_DIR)
+ # get extra all source files
+ file(GLOB TCF_EXTRA_SRCS_REL RELATIVE ${TCF_EXTRA_DIR}
+ ${TCF_EXTRA_DIR}/system/${TCF_OPSYS}/tcf/*.c
+ ${TCF_EXTRA_DIR}/machine/${TCF_MACHINE}/tcf/*.c
+ ${TCF_EXTRA_DIR}/tcf/framework/*.c
+ ${TCF_EXTRA_DIR}/tcf/services/*.c
+ ${TCF_EXTRA_DIR}/tcf/main/*.c)
+
+ # Override regular files with extra files
+ list(REMOVE_ITEM TCF_SRCS_REL ${TCF_EXTRA_SRCS_REL})
+
+ foreach(file ${TCF_EXTRA_SRCS_REL})
+ list(APPEND TCF_SRCS ${TCF_EXTRA_DIR}/${file})
+ endforeach(file)
+endif()
+
+foreach(file ${TCF_SRCS_REL})
+ list(APPEND TCF_SRCS ${TCF_BASE_DIR}/${file})
+endforeach(file)
+
+if(DEFINED TCF_EXTRA_DIR)
+ include_directories(${TCF_EXTRA_DIR} ${TCF_EXTRA_DIR}/system/${TCF_OPSYS} ${TCF_EXTRA_DIR}/machine/${TCF_MACHINE})
+endif()
+include_directories(${TCF_BASE_DIR} ${TCF_BASE_DIR}/system/${TCF_OPSYS} ${TCF_BASE_DIR}/machine/${TCF_MACHINE})
+
+set_source_files_properties(${TCF_SRCS} PROPERTIES
+ COMPILE_FLAGS "${MULTI_THREADED_COMPILE_FLAGS}")
+add_library(${TCF_LIB_NAME} ${TCF_LIB_TYPE} ${TCF_SRCS})
+target_link_libraries(${TCF_LIB_NAME}
+ ${UUID_LIB_NAME} ${MULTI_THREADED_LINK_LIBS} ${SOCKET_LINK_LIBS})
+
+if(SSL_LIB_NAME)
+ target_link_libraries(${TCF_LIB_NAME} ${SSL_LIB_NAME})
+else()
+ add_definitions("-DENABLE_SSL=0")
+endif()
+
+if(DEFINED TCF_PLUGIN_PATH)
+ add_definitions(-DPATH_Plugins=${TCF_PLUGIN_PATH})
+ if (UNIX)
+ target_link_libraries(${TCF_LIB_NAME} dl)
+ endif()
+endif()

Back to the top