libgluonutil: simplify CMakeLists.txt
libgluonutil is not usable outside the OpenWrt/LEDE environment anyways, so it doesn't make much sense to make the CMakeLists.txt overly generic.
This commit is contained in:
parent
020afc856f
commit
414dfa8155
@ -1,24 +1,15 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
project(libgluonutil C)
|
||||
|
||||
set(LIBDIR "lib${LIB_SUFFIX}")
|
||||
|
||||
find_package(JSON_C REQUIRED)
|
||||
|
||||
set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
|
||||
|
||||
add_library(gluonutil SHARED libgluonutil.c)
|
||||
set_property(TARGET gluonutil PROPERTY COMPILE_FLAGS "-Wall -std=c99 ${JSON_C_CFLAGS_OTHER}")
|
||||
set_property(TARGET gluonutil PROPERTY LINK_FLAGS "${JSON_C_LDFLAGS_OTHER}")
|
||||
set_property(TARGET gluonutil APPEND PROPERTY INCLUDE_DIRECTORIES ${JSON_C_INCLUDE_DIR})
|
||||
target_link_libraries(gluonutil ${JSON_C_LIBRARIES})
|
||||
set_property(TARGET gluonutil PROPERTY COMPILE_FLAGS "-Wall -std=c99")
|
||||
target_link_libraries(gluonutil json-c)
|
||||
install(TARGETS gluonutil
|
||||
ARCHIVE DESTINATION ${LIBDIR}
|
||||
LIBRARY DESTINATION ${LIBDIR}
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libgluonutil.h DESTINATION include)
|
||||
|
@ -1,20 +0,0 @@
|
||||
# Defines the following variables:
|
||||
# JSON_C_FOUND
|
||||
# JSON_C_INCLUDE_DIR
|
||||
# JSON_C_LIBRARIES
|
||||
# JSON_C_CFLAGS_OTHER
|
||||
# JSON_C_LDFLAGS_OTHER
|
||||
|
||||
|
||||
find_package(PkgConfig REQUIRED QUIET)
|
||||
|
||||
pkg_check_modules(_JSON_C json-c)
|
||||
|
||||
find_path(JSON_C_INCLUDE_DIR NAMES json-c/json.h HINTS ${_JSON_C_INCLUDE_DIRS})
|
||||
find_library(JSON_C_LIBRARIES NAMES json-c HINTS ${_JSON_C_LIBRARY_DIRS})
|
||||
|
||||
set(JSON_C_CFLAGS_OTHER "${_JSON_C_CFLAGS_OTHER}" CACHE STRING "Additional compiler flags for json-c")
|
||||
set(JSON_C_LDFLAGS_OTHER "${_JSON_C_LDFLAGS_OTHER}" CACHE STRING "Additional linker flags for json-c")
|
||||
|
||||
find_package_handle_standard_args(JSON_C REQUIRED_VARS JSON_C_LIBRARIES JSON_C_INCLUDE_DIR)
|
||||
mark_as_advanced(JSON_C_INCLUDE_DIR JSON_C_LIBRARIES JSON_C_CFLAGS_OTHER JSON_C_LDFLAGS_OTHER)
|
Loading…
Reference in New Issue
Block a user