libopkg: remove GPG support
[oweals/opkg-lede.git] / CMakeLists.txt
index 721f848..52d01f7 100644 (file)
@@ -2,9 +2,11 @@ cmake_minimum_required(VERSION 2.6)
 
 PROJECT(opkg C)
 
-OPTION(HOST_CPU "Override Host CPU")
-OPTION(BUILD_CPU "Override Host CPU")
-OPTION(STATIC_UBOX "Statically link libubox")
+SET(HOST_CPU "" CACHE STRING "Override Host CPU")
+SET(BUILD_CPU "" CACHE STRING "Override Host CPU")
+SET(LOCK_FILE "/var/lock/opkg.lock" CACHE STRING "Override lock file path")
+
+OPTION(STATIC_UBOX "Statically link libubox" OFF)
 OPTION(BUILD_TESTS "Build test programs" ON)
 
 IF(NOT HOST_CPU)
@@ -15,13 +17,23 @@ IF(NOT BUILD_CPU)
        SET(BUILD_CPU "${CMAKE_SYSTEM_PROCESSOR}")
 ENDIF()
 
+EXECUTE_PROCESS(COMMAND git log -1 "--format=%h (%ci)"
+       OUTPUT_VARIABLE GIT_VERSION
+       OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+IF(NOT GIT_VERSION)
+       SET(GIT_VERSION "unknown")
+ENDIF()
+
 ADD_DEFINITIONS(-Os -Wall --std=gnu99 -g3 -Wmissing-declarations
        -DDATADIR="/usr/share"
        -DOPKGETCDIR="/etc"
-       -DOPKGLOCKFILE="/var/lock/opkg.lock"
+       -DOPKGLOCKFILE="${LOCK_FILE}"
        -DOPKGLIBDIR="/usr/lib"
        -DHOST_CPU_STR="${HOST_CPU}"
        -DBUILD_CPU=${BUILD_CPU}
+       -DVERSION="${GIT_VERSION}"
 )
 
 ADD_SUBDIRECTORY(libbb)