summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2013-01-28 19:48:54 +0100
committerKozlov Dmitry <xeb@mail.ru>2013-02-06 20:51:05 +0400
commit3565aac70d801a08b82aa3b4ed268b3470488d57 (patch)
tree411dcf36b3a62d876d74b462f8779405c9428e1b /CMakeLists.txt
parentaae3d45a85cb4f4a77f2bd129d43b21307966fb0 (diff)
downloadaccel-ppp-3565aac70d801a08b82aa3b4ed268b3470488d57.tar.gz
accel-ppp-3565aac70d801a08b82aa3b4ed268b3470488d57.zip
build: Set ACCEL_PPP_VERSION in top level cmake file
Move definition of ACCEL_PPP_VERSION from /accel-pppd/CMakeLists.txt to /CMakeLists.txt so that it gets visible by any cmake file. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3efcd2b8..c1b01c90 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,35 @@ project(accel-ppp C)
include(cmake/cpack.cmake)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fvisibility=hidden -fno-strict-aliasing -D_GNU_SOURCE -fPIC")
+
+IF (NOT DEFINED LIB_SUFFIX)
+ EXECUTE_PROCESS(
+ COMMAND uname -m
+ COMMAND tr -d '\n'
+ OUTPUT_VARIABLE ARCH
+ )
+ message(STATUS "'" ${ARCH} "'")
+ IF (ARCH STREQUAL x86_64)
+ SET(LIB_SUFFIX 64)
+ ENDIF (ARCH STREQUAL x86_64)
+ENDIF (NOT DEFINED LIB_SUFFIX)
+
+IF (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT DEFINED IGNORE_GIT)
+ EXECUTE_PROCESS(
+ COMMAND git log --no-color
+ COMMAND head -n1
+ COMMAND awk "{print $2}"
+ WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
+ OUTPUT_VARIABLE ACCEL_PPP_VERSION
+ )
+ STRING(STRIP ${ACCEL_PPP_VERSION} ACCEL_PPP_VERSION)
+ELSE (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT DEFINED IGNORE_GIT)
+ SET (ACCEL_PPP_VERSION 1.8.0-beta)
+ENDIF (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT DEFINED IGNORE_GIT)
+
+ADD_DEFINITIONS(-DACCEL_PPP_VERSION="${ACCEL_PPP_VERSION}")
+
if (NOT BUILD_DRIVER_ONLY)
if (MEMDEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector -fstack-protector-all")
@@ -40,3 +69,4 @@ endif (BUILD_DRIVER OR BUILD_DRIVER_ONLY)
if (BUILD_IPOE_DRIVER)
add_subdirectory(drivers/ipoe)
endif (BUILD_IPOE_DRIVER)
+