From 845d006ccee4ee4722551d902095de04defcd8e6 Mon Sep 17 00:00:00 2001 From: wangguibao Date: Fri, 2 Aug 2019 18:13:30 +0800 Subject: [PATCH] Fix cube_builder cmake --- cmake/external/jsoncpp.cmake | 4 +++- cube/cube-builder/CMakeLists.txt | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cmake/external/jsoncpp.cmake b/cmake/external/jsoncpp.cmake index 0f0136d6..c993ca0f 100644 --- a/cmake/external/jsoncpp.cmake +++ b/cmake/external/jsoncpp.cmake @@ -17,7 +17,7 @@ INCLUDE(ExternalProject) SET(JSONCPP_SOURCES_DIR ${THIRD_PARTY_PATH}/jsoncpp) SET(JSONCPP_INSTALL_DIR ${THIRD_PARTY_PATH}/install/jsoncpp) SET(JSONCPP_INCLUDE_DIR "${JSONCPP_INSTALL_DIR}/include" CACHE PATH "jsoncpp include directory." FORCE) -SET(JSONCPP_LIBRARIES "${JSONCPP_INSTALL_DIR}/lib" CACHE FILEPATH "jsoncpp library." FORCE) +SET(JSONCPP_LIBRARIES "${JSONCPP_INSTALL_DIR}/lib/libjsoncpp.a" CACHE FILEPATH "jsoncpp library." FORCE) INCLUDE_DIRECTORIES(${JSONCPP_INCLUDE_DIR}) ExternalProject_Add( @@ -36,10 +36,12 @@ ExternalProject_Add( -DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG} -DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE} -DCMAKE_INSTALL_PREFIX=${JSONCPP_INSTALL_DIR} + -DCMAKE_INSTALL_LIBDIR=${JSONCPP_INSTALL_DIR}/lib -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE} ${EXTERNAL_OPTIONAL_ARGS} CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${JSONCPP_INSTALL_DIR} + -DCMAKE_INSTALL_LIBDIR=:PATH=${JSONCPP_INSTALL_DIR}/lib -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE} ) diff --git a/cube/cube-builder/CMakeLists.txt b/cube/cube-builder/CMakeLists.txt index 84fe7674..db64f439 100755 --- a/cube/cube-builder/CMakeLists.txt +++ b/cube/cube-builder/CMakeLists.txt @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License -project(cube-builder) - set(CMAKE_CXX_STANDARD 11) add_compile_options(-std=c++11) @@ -22,10 +20,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/include) include_directories(SYSTEM ${CMAKE_CURRENT_BINARY_DIR}/../) -find_path(JSONCPP_INCLUDE_DIR json/json.h) -set(JSONCPP_LIBRARY ${JSONCPP_INCLUDE_DIR}/../lib/libjsoncpp.a) -message(STATUS "jsoncpp include: ${JSONCPP_INCLUDE_DIR}") -include_directories(${JSONCPP_INCLUDE_DIR}) +#find_path(JSONCPP_INCLUDE_DIR json/json.h) +#set(JSONCPP_LIBRARY ${JSONCPP_INCLUDE_DIR}/../lib/libjsoncpp.a) +#message(STATUS "jsoncpp include: ${JSONCPP_INCLUDE_DIR}") +#include_directories(${JSONCPP_INCLUDE_DIR}) find_library(CURL_LIB NAMES curl) @@ -35,9 +33,11 @@ endif() add_executable(cube-builder src/main.cpp include/cube-builder/util.h src/util.cpp src/builder_job.cpp include/cube-builder/builder_job.h include/cube-builder/define.h src/seqfile_reader.cpp include/cube-builder/seqfile_reader.h include/cube-builder/raw_reader.h include/cube-builder/vtext.h src/crovl_builder_increment.cpp include/cube-builder/crovl_builder_increment.h src/curl_simple.cpp include/cube-builder/curl_simple.h) +add_dependencies(cube-builder jsoncpp) + set(DYNAMIC_LIB gflags - ${JSONCPP_LIBRARY} + jsoncpp -lssl -lcrypto ${CURL_LIB} -- GitLab