changed: cjson handling

- probe only for system lib (i.e. only probe in prefix paths)
old code ended up not installing the json lib due to finding a copy
in the build folder if a reconfiguration was performed.

- build internal copy static and bundle in libopm-json.so
no reason to install this as a shared library. if it is updated
originating from opm, the entire parser library is updated anyways.
This commit is contained in:
Arne Morten Kvarving 2014-11-18 10:08:38 +01:00
parent a42b503bac
commit 303b9bc885
2 changed files with 4 additions and 12 deletions

View File

@ -20,10 +20,8 @@ endif (CJSON_ROOT)
find_path (CJSON_INCLUDE_DIR find_path (CJSON_INCLUDE_DIR
NAMES "cjson/cJSON.h" NAMES "cjson/cJSON.h"
HINTS "${CJSON_ROOT}" HINTS "${CJSON_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/../opm-parser"
PATH_SUFFIXES "include" "opm/json" PATH_SUFFIXES "include" "opm/json"
DOC "Path to cjson library header files" DOC "Path to cjson library header files")
${_no_default_path} )
# find out the size of a pointer. this is required to only search for # find out the size of a pointer. this is required to only search for
# libraries in the directories relevant for the architecture # libraries in the directories relevant for the architecture
@ -36,13 +34,9 @@ string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PR
find_library (CJSON_LIBRARY find_library (CJSON_LIBRARY
NAMES "cjson" NAMES "cjson"
HINTS "${CJSON_ROOT}" HINTS "${CJSON_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../opm-parser"
"${PROJECT_BINARY_DIR}/../opm-parser${BUILD_DIR_SUFFIX}"
"${PROJECT_BINARY_DIR}/../../opm-parser/${BUILD_DIR_SUFFIX}"
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
"opm/json" "opm/json"
DOC "Path to cjson library archive/shared object files" DOC "Path to cjson library archive/shared object files")
${_no_default_path} )
# setup list of all required libraries to link with cjson # setup list of all required libraries to link with cjson
set (CJSON_INCLUDE_DIRS ${CJSON_INCLUDE_DIR}) set (CJSON_INCLUDE_DIRS ${CJSON_INCLUDE_DIR})

View File

@ -1,9 +1,7 @@
if (NOT HAVE_CJSON) if (NOT HAVE_CJSON)
add_library( cjson cjson/cJSON.c ) add_library( cjson STATIC cjson/cJSON.c )
set_target_properties(cjson PROPERTIES COMPILE_FLAGS -fPIC)
set( CJSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) set( CJSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
install( TARGETS cjson DESTINATION ${CMAKE_INSTALL_LIBDIR} )
install( FILES cjson/cJSON.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/cjson )
set( CJSON_LIBRARY cjson ) set( CJSON_LIBRARY cjson )
endif() endif()