boost , opencv项目使用cmake编译

cmake似乎是很强大,不过还不会用-,-

准备抽空看看。。

不过即使不会用,还是可以编译的,很简单。

 

boost

#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>

int main () {
    using namespace boost::numeric::ublas;
    matrix<double> m (3, 3);
    for (unsigned i = 0; i < m.size1 (); ++ i)
        for (unsigned j = 0; j < m.size2 (); ++ j)
            m (i, j) = 3 * i + j;
    std::cout << m << std::endl;
}

一个简单的矩阵的例子,CMakeLists.txt如下

PROJECT (HELLO)
SET(SRC_LIST main.cpp)
find_package(Boost REQUIRED)
ADD_EXECUTABLE(hello ${SRC_LIST})
target_link_libraries(HELLO ${Boost_LIBS})

 

 

opencv的如下

project( cv_test )
find_package( OpenCv REQUIRED )
add_executable(cv_test opencv)
target_link_libraries( cv_test ${OpenCV_LIBS})

你可能感兴趣的:(opencv)