From 303b9bc8852ca1d1f11c665ba0275f1039b979f9 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 18 Nov 2014 10:08:38 +0100 Subject: [PATCH] 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. --- cmake/Modules/Findcjson.cmake | 10 ++-------- opm/json/CMakeLists.txt | 6 ++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/cmake/Modules/Findcjson.cmake b/cmake/Modules/Findcjson.cmake index 570557391..a086a6060 100644 --- a/cmake/Modules/Findcjson.cmake +++ b/cmake/Modules/Findcjson.cmake @@ -20,10 +20,8 @@ endif (CJSON_ROOT) find_path (CJSON_INCLUDE_DIR NAMES "cjson/cJSON.h" HINTS "${CJSON_ROOT}" - PATHS "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/../opm-parser" PATH_SUFFIXES "include" "opm/json" - DOC "Path to cjson library header files" - ${_no_default_path} ) + DOC "Path to cjson library header files") # find out the size of a pointer. this is required to only search for # 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 NAMES "cjson" 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}" "opm/json" - DOC "Path to cjson library archive/shared object files" - ${_no_default_path} ) + DOC "Path to cjson library archive/shared object files") # setup list of all required libraries to link with cjson set (CJSON_INCLUDE_DIRS ${CJSON_INCLUDE_DIR}) diff --git a/opm/json/CMakeLists.txt b/opm/json/CMakeLists.txt index b9b8757d6..f17c26256 100644 --- a/opm/json/CMakeLists.txt +++ b/opm/json/CMakeLists.txt @@ -1,9 +1,7 @@ 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} ) - install( TARGETS cjson DESTINATION ${CMAKE_INSTALL_LIBDIR} ) - install( FILES cjson/cJSON.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/cjson ) - set( CJSON_LIBRARY cjson ) endif()