X-Git-Url: http://git.openwrt.org/?p=project%2Fucert.git;a=blobdiff_plain;f=CMakeLists.txt;h=436abc6857b3c1082e0d006239b3dee1d83e0fda;hp=2554ffef3fd7c68f5d3bc876b22e0cc770c23a66;hb=e284ed941972e850951cc11f8065dc4126079daa;hpb=57c42c1a711248bf9057a8c4313dedddf0d43753 diff --git a/CMakeLists.txt b/CMakeLists.txt index 2554ffe..436abc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,40 @@ cmake_minimum_required(VERSION 2.6) PROJECT(ucert C) -ADD_DEFINITIONS(-Os -ggdb -Wall --std=gnu99 -Wmissing-declarations) + +ADD_DEFINITIONS(-Wall -Werror) +IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6) + ADD_DEFINITIONS(-Wextra -Werror=implicit-function-declaration) + ADD_DEFINITIONS(-Wformat -Werror=format-security -Werror=format-nonliteral) +ENDIF() +ADD_DEFINITIONS(-Os -std=gnu99 -ggdb -Wmissing-declarations -Wno-unused-parameter) SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -find_library(json NAMES json-c json) +FIND_PATH(ubox_include_dir NAMES libubox/usock.h) +FIND_PATH(jsonc_include_dir NAMES json-c/json.h) +INCLUDE_DIRECTORIES(${ubox_include_dir} ${jsonc_include_dir}) + +FIND_LIBRARY(ubox NAMES ubox) +FIND_LIBRARY(blobmsg_json NAMES blobmsg_json) +FIND_LIBRARY(json NAMES json-c json) + +IF(UCERT_HOST_BUILD) +ADD_DEFINITIONS(-DUCERT_HOST_BUILD) +ENDIF() + +IF(USE_RPATH) +SET(CMAKE_INSTALL_RPATH "${USE_RPATH}") +SET(CMAKE_MACOSX_RPATH 1) +ENDIF() ADD_EXECUTABLE(ucert ucert.c usign-exec.c) IF(UCERT_FULL) ADD_DEFINITIONS(-DUCERT_FULL) -TARGET_LINK_LIBRARIES(ucert ubox blobmsg_json ${json}) +TARGET_LINK_LIBRARIES(ucert ${ubox} ${blobmsg_json} ${json}) ELSE() ADD_DEFINITIONS(-DUCERT_STRIP_MESSAGES) -TARGET_LINK_LIBRARIES(ucert ubox) +TARGET_LINK_LIBRARIES(ucert ${ubox}) ENDIF() INSTALL(TARGETS ucert RUNTIME DESTINATION bin)