Linux uses cmakelists to compile programs or generate library files

Source: Internet
Author: User

#set CMake minimum versionCmake_minimum_required (VERSION 2.8)#set the project nameSET (project_name image_test_01)#Build a projectPROJECT (${project_name})#Find OpenCV Libraryfind_package (OpenCV REQUIRED) include_directories (${opencv_include_dirs})#Print debugging InformationMESSAGE (STATUS"Project: ${project_name}") MESSAGE (STATUS"OpenCV Library Status:") MESSAGE (STATUS"version: ${opencv_version}") MESSAGE (STATUS"libraries: ${opencv_libs}") MESSAGE (STATUS"include path: ${opencv_include_dirs}")#get the code, in the project, put all the code in the SRC folderaux_source_directory (src dir_srcs) MESSAGE (STATUS"Src file: ${dir_srcs}")#compiling an executable programadd_executable (${project_name} ${dir_srcs})#Add a link libraryTarget_link_libraries (${project_name} ${opencv_libs})

Reference: http://blog.csdn.net/ryuuei_1984/article/details/52209331

Linux uses cmakelists to compile programs or generate library files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.