summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2010-08-11 22:28:19 +0200
committerStefan Bühler <stbuehler@web.de>2010-08-11 22:28:19 +0200
commitc39c6ee64bbae9fd81fb4da168dfa7583c1af703 (patch)
tree257cd3f621ceec471887862ce120ede18b3c63d0 /CMakeLists.txt
downloadlibmanda-c39c6ee64bbae9fd81fb4da168dfa7583c1af703.tar.gz
libmanda-c39c6ee64bbae9fd81fb4da168dfa7583c1af703.zip
Initial commit
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt56
1 files changed, 56 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..abe55ca
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,56 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
+
+cmake_policy(VERSION 2.6.0)
+
+SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckLibraryExists)
+INCLUDE(FindPkgConfig)
+
+MACRO(ADD_TARGET_PROPERTIES _target _name _properties)
+ SET(_properties ${ARGV})
+ LIST(REMOVE_AT _properties 0)
+ LIST(REMOVE_AT _properties 0)
+ GET_TARGET_PROPERTY(_old_properties ${_target} ${_name})
+ #MESSAGE("adding property to ${_target} ${_name}: ${_properties}")
+ IF(NOT _old_properties)
+ # in case it's NOTFOUND
+ SET(_old_properties)
+ ELSE(NOT _old_properties)
+ SET(_old_properties "${_old_properties} ")
+ ENDIF(NOT _old_properties)
+ SET_TARGET_PROPERTIES(${_target} PROPERTIES ${_name} "${_old_properties}${_properties}")
+ENDMACRO(ADD_TARGET_PROPERTIES)
+
+PROJECT(libmanda)
+SET(PACKAGE_VERSION 0.1.0)
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+ SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+
+# GLIB 2
+pkg_check_modules (GLIB2 REQUIRED glib-2.0)
+SET(GLIB_INCLUDES ${GLIB2_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS}/glib-2.0/ ${GLIB2_INCLUDE_DIRS}/glib-2.0/include/)
+INCLUDE_DIRECTORIES(${GLIB_INCLUDES})
+
+SET(MAIN_SOURCE libmanda.c)
+
+SET(PACKAGE_NAME ${CMAKE_PROJECT_NAME})
+SET(PACKAGE_VERSION ${PACKAGE_VERSION})
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libmanda-config.h.cmake ${CMAKE_BINARY_DIR}/libmanda-config.h ESCAPE_QUOTES)
+ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
+
+add_library(manda SHARED ${MAIN_SOURCE})
+
+ADD_TARGET_PROPERTIES(manda COMPILE_FLAGS "-std=gnu99 -Wall -g -Wshadow -W -pedantic -fPIC -D_GNU_SOURCE")
+
+# GLIB 2
+ADD_TARGET_PROPERTIES(manda LINK_FLAGS "${GLIB2_LDFLAGS}")
+ADD_TARGET_PROPERTIES(manda COMPILE_FLAGS "${GLIB2_CFLAGS_OTHER}")
+
+INSTALL(TARGETS manda DESTINATION lib EXPORT libmanda)
+INSTALL(FILES manda.h ${CMAKE_CURRENT_BINARY_DIR}/libmanda-config.h DESTINATION include)
+INSTALL(EXPORT libmanda DESTINATION lib/libmanda)