如何为ubuntu环境更改CmakeLists

时间:2017-05-28 16:38:07

标签: windows ubuntu compilation cmake ros

我想编译一个program,它基本上是在windows下创建和编译的。现在我想在linux下使用该程序但是我遇到了像lib这样的错误:

/usr/bin/ld: cannot find -llibRUNETag
collect2: error: ld returned 1 exit status
runtag/runetage/RUNEtagdetect/CMakeFiles/RUNEtagdetect.dir/build.make:164: recipe for target '/home/jaouadhros/catkin_ws/devel/lib/runetage/RUNEtagdetect' failed
make[2]: *** [/home/jaouadhros/catkin_ws/devel/lib/runetage/RUNEtagdetect] Error 1
CMakeFiles/Makefile2:3479: recipe for target 'runtag/runetage/RUNEtagdetect/CMakeFiles/RUNEtagdetect.dir/all' failed
make[1]: *** [runtag/runetage/RUNEtagdetect/CMakeFiles/RUNEtagdetect.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed

我想知道如何更改我的CmakeLists,以便在我的环境中成功编译它。 我使用Ubuntu 16使用ROS框架

这是CmakeLists:

cmake_minimum_required(VERSION 2.8.3)
project(runetage)

OPTION( BUILD_SHARED_LIBS "Set to off to build static libraries" ON )
OPTION( BUILD_RUNETAGDETECT "Create RUNEtagdetect executable" ON )
OPTION( BUILD_CODEGEN "Create codegen executable" ON )


IF( NOT CMAKE_BUILD_TYPE )
    SET( CMAKE_BUILD_TYPE "Release" )
ENDIF()


IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET( CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/../dist" CACHE PATH "Install prefix" FORCE )
ENDIF()

## Add support for C++11, supported in ROS Kinetic and newer
# add_definitions(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
)

find_package(OpenCV REQUIRED)


catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES runetage
#  CATKIN_DEPENDS roscpp std_msgs
#  DEPENDS system_lib
)

###########
## Build ##
###########

include_directories(
  ${catkin_INCLUDE_DIRS}
)
#############
## Install ##
#############

ADD_SUBDIRECTORY( WinNTL )


INCLUDE_DIRECTORIES( "${PROJECT_SOURCE_DIR}/include"
                      ${OpenCV_INCLUDE_DIRS} 
                      "WinNTL/include"
                       )

INSTALL( DIRECTORY "${PROJECT_SOURCE_DIR}/include" DESTINATION . )
INSTALL( DIRECTORY "${PROJECT_SOURCE_DIR}/WinNTL/include" DESTINATION . )

SET( RUNETAG_SRCS 
        src/auxmath.cpp
        src/auxrenderer.cpp
        src/ellipsefitter.cpp
        src/ellipsepoint.cpp
        src/fpscounter.cpp
        src/hirestimer.cpp
        src/markerdetector.cpp
        src/markerpose.cpp
        src/slotfitter.cpp
        src/ellipserefine.cpp
        src/ellipsedetector.cpp
        src/digitalmarkermodel.cpp
        src/slot.cpp
        src/coding.cpp
        )

SET( RUNETAG_INCL 
      "include/auxmath.hpp"
      "include/auxrenderer.hpp"
      "include/digitalmarkermodel.hpp"
      "include/ellipsefitter.hpp"
      "include/ellipsepoint.hpp"
      "include/fpscounter.hpp"
      "include/hirestimer.hpp"
      "include/imgtextstream.hpp"
      "include/markerdetected.hpp"
      "include/markerdetector.hpp"
      "include/markerpose.hpp"
      "include/slot.hpp"
      "include/slotfitter.hpp"
      "include/ellipserefine.hpp"
      "include/ellipsedetector.hpp"
      "include/runetag.hpp"
      "include/coding.h")


ADD_LIBRARY( ${PROJECT_NAME} STATIC ${RUNETAG_SRCS} ${RUNETAG_INCL} )
TARGET_LINK_LIBRARIES(${PROJECT_NAME} WinNTL ${OpenCV_LIBS})
SET_TARGET_PROPERTIES( ${PROJECT_NAME} 
                        PROPERTIES 
                        VERSION "${${PROJECT_NAME}_VERSION}" 
                        SOVERSION "${${PROJECT_NAME}_SOVERSION}" 
                        CLEAN_DIRECT_OUTPUT 1 
                        OUTPUT_NAME ${PROJECT_NAME} )


INSTALL( TARGETS ${PROJECT_NAME} DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )


IF( BUILD_RUNETAGDETECT )
ADD_SUBDIRECTORY( RUNEtagdetect )
ENDIF()





IF( BUILD_CODEGEN )
ADD_SUBDIRECTORY( codegen )
ENDIF()


IF( BUILD_VIRTUALCAMERA )
ADD_SUBDIRECTORY( virtualcamera )
ENDIF()


MESSAGE( STATUS )
MESSAGE( STATUS "Build Settings:" )
MESSAGE( STATUS "------------------------------------------------" )
MESSAGE( STATUS "BUILD_SHARED_LIBS\t\t= ${BUILD_SHARED_LIBS}" )
MESSAGE( STATUS "CMAKE_INSTALL_PREFIX\t\t= ${CMAKE_INSTALL_PREFIX}" )
MESSAGE( STATUS "CMAKE_BUILD_TYPE\t\t= ${CMAKE_BUILD_TYPE}  (Options: Release, Debug, MinSizeRel, RelWithDebInfo)" )
MESSAGE( STATUS )
MESSAGE( STATUS "You can change this values with cmake -D<Variable>=<Value>" )
MESSAGE( STATUS "------------------------------------------------" )

这是同一个包但另一个项目的另一个:

PROJECT( RUNEtagdetect )

SET(Boost_ADDITIONAL_VERSIONS "1.49.0" )

#SET(Boost_DEBUG ON)
#SET(Boost_DETAILED_FAILURE_MSG ON)
SET(Boost_USE_STATIC_LIBS ON)


find_package( Boost REQUIRED COMPONENTS program_options )



IF( VERBOSE_FLAG  )
ADD_DEFINITIONS( -DVERBOSE )
ENDIF()


INCLUDE_DIRECTORIES(.
                    "../include"
                    ${OpenCV_INCLUDE_DIRS}
                    ${Boost_INCLUDE_DIRS}
                    )


ADD_EXECUTABLE( ${PROJECT_NAME} RUNEtagdetect.cpp  test_occlusion.cpp test_occlusion.h)

TARGET_LINK_LIBRARIES(  ${PROJECT_NAME} libRUNETag ${OpenCV_LIBS} ${Boost_PROGRAM_OPTIONS_LIBRARY} WinNTL )

INSTALL( TARGETS ${PROJECT_NAME} DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )

0 个答案:

没有答案