下面给出完整的设置:
cmake_minimum_required(VERSION 2.8) set(Loki_HOME /usr/local/src/loki-0.1.7) set(Loki_INCLUDE_DIR ${Loki_HOME}/include) set(Loki_LIBRARY_DIR ${Loki_HOME}/lib) set(Loki_LIBRARY ${Loki_HOME}/lib/libloki.so.0.1.7) set(Boost_HOME /usr/local/src/boost_1_47_0) set(Boost_INCLUDE_DIR ${Boost_HOME}) set(Boost_LIBRARY_DIR ${Boost_HOME}/stage/lib) set(CPPDB_INCLUDE_DIR /usr/include/cppdb) set(CPPDB_LIBRARY_DIR /usr/lib/) set(CPPDB_LIBRARY /usr/lib/libcppdb.so) set(PROJECT_INCLUDE_DIR /home/chenshu/work/CommonService/trunk/BatchService/include) set(PROJECT_SOURCE_DIR /home/chenshu/work/CommonService/trunk/BatchService/src) set(MONGODB_INCLUDE_DIR /usr/local/src/mongo-cxx-driver-v1.8/mongo) add_definitions(-DBOOST_FILESYSTEM_VERSION=2) find_package (Threads) find_package(Boost COMPONENTS system filesystem thread log program_options REQUIRED) message("--------------------------------------------") message(${Boost_HOME}) message(${Loki_HOME}) message(${MONGODB_INCLUDE_DIR}) message("--------------------------------------------") include_directories(${Boost_INCLUDE_DIR} ${Loki_INCLUDE_DIR} ${CPPDB_INCLUDE_DIR} ${PROJECT_INCLUDE_DIR} ${MONGODB_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR} ${Loki_LIBRARY_DIR} ${CPPDB_LIBRARY_DIR}) add_executable(main ThreadFunction.cpp Application.cpp SqlSessionFactory.cpp VillageService.cpp ThreadManager.cpp main.cpp) target_link_libraries( main mongoclient ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${Loki_LIBRARY} ${CPPDB_LIBRARY} )
Powered by: 博客园 Copyright © 2025 阳光VIP Powered by .NET 9.0 on Kubernetes