Thread: CMake, how do I add libraries, includes, header files?
i have cpp program uses mrpt (mobile robots programming toolkit) libraries, , compiles using cmake.
want include more libraries in cpp program, example aria , opencv.
when compile aria , opencv programs, don't use cmake, use makefile includes cflags , ldflags.
however, how use these cmake? have tried lot 'undefined reference to' errors.
can provide me step-by-step guide adding third-party headers cmake file? header want included aria.h
cmakelists.txt file, can see have tried include aria libraries still doesn't work.
code:project(mrpt_example1) cmake_minimum_required(version 2.4) if(command cmake_policy) cmake_policy(set cmp0003 new) # required cmake 2.7+ endif(command cmake_policy) # -------------------------------------------------------------------------- # list of "libs" can included can found in: # http://www.mrpt.org/libraries # # dependencies of library automatically added, # need specify top-most libraries code depend on. # -------------------------------------------------------------------------- find_path(usr/local/aria/include names aria.h paths /usr/local/aria/include/ required) #add_library(${aria_dir}/include/ aria.h) find_library(aria_library names laria larnetworking lpthread ldl lrt paths /usr/local/aria/lib) include_directories(${aria_dir}/include) link_directories(${aria_dir}/lib) find_package( mrpt required base) # declare target (an executable) add_executable(mrpt_example1 test.cpp ) target_link_libraries(mrpt_example1 ${mrpt_libs} ${aria_libs}) # set optimized building: if(cmake_compiler_is_gnucxx , not cmake_build_type matches "debug") set(cmake_cxx_flags "${cmake_cxx_flags} -o3 -mtune=native") endif(cmake_compiler_is_gnucxx , not cmake_build_type matches "debug")
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk CMake, how do I add libraries, includes, header files?
Ubuntu
Comments
Post a Comment