cmake教程(一)qt cmake


https://www.cnblogs.com/dilex/p/11102152.html

cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)

set(project_name DEPTHMATH3D)

project(${project_name})

#打开全局moc
set(CMAKE_AUTOMOC ON)
#打开全局uic
set(CMAKE_AUTOUIC ON)
#打开全局rcc
set(CMAKE_AUTORCC ON)

#SET(CMAKE_BUILD_TYPE "Debug")


############################################库文件
#boost
set(BOOST_ROOT ${PROJECT_SOURCE_DIR}/../3dpart/PCL1.8.1/3rdParty/Boost)
set(BOOST_INCLUDEDIR ${PROJECT_SOURCE_DIR}/../3dpart/PCL1.8.1/3rdParty/Boost/include/boost-1_64)
set(BOOST_LIBRARYDIR ${PROJECT_SOURCE_DIR}/../3dpart/PCL1.8.1/3rdParty/Boost/lib)


find_package(BOOST_ROOT)
include_directories(${BOOST_INCLUDEDIR})
link_directories(${BOOST_LIBRARYDIR})

#link_libraries(libboost_atomic-vc141-mt-1_64)

# 验证是否发现boost
#if(BOOST_ROOT)
#message ("boost found")
#else()
#message (FATAL_ERROR "Cannot find Boost")
#endif()


#qt
find_package(Qt5 REQUIRED Widgets)

############################################源码和生成文件
#target_include_directories():指定目标包含的头文件路径。官方文档
#target_link_libraries():指定目标链接的库。官方文档
#target_compile_options():指定目标的编译选项。官方文档
#目标 由 add_library()add_executable() 生成。

#PROJECT(main)
#CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
ADD_SUBDIRECTORY( src )
AUX_SOURCE_DIRECTORY(. DIR_SRCS)
#ADD_EXECUTABLE(main ${DIR_SRCS}  )
#TARGET_LINK_LIBRARIES( main Test )

set(target_name sgshdmap)
add_executable(${target_name} ${DIR_SRCS} main.cpp ManagerWidget.cpp ManagerWidget.h ManagerWidget.ui)



target_include_directories( ${target_name} PRIVATE  ${Boost_INCLUDE_DIRS})
target_link_libraries(${target_name} Qt5::Widgets)










#target_link_libraries(${target_name} ${Boost_SYSTEM_LIBRARY}
#    ${Boost_FILESYSTEM_LIBRARY}
#            -llibboost_atomic-vc141-mt-1_64
#            -llibboost_bzip2-vc141-mt-1_64
#            -llibboost_chrono-vc141-mt-1_64
#            -llibboost_container-vc141-mt-1_64
#            -llibboost_context-vc141-mt-1_64
#            -llibboost_coroutine-vc141-mt-1_64
#            -llibboost_date_time-vc141-mt-1_64
#            -llibboost_exception-vc141-mt-1_64
#            -llibboost_fiber-vc141-mt-1_64
#            -llibboost_filesystem-vc141-mt-1_64
#            -llibboost_graph-vc141-mt-1_64
#            -llibboost_graph_parallel-vc141-mt-1_64
#            -llibboost_iostreams-vc141-mt-1_64
#            -llibboost_locale-vc141-mt-1_64
#            -llibboost_log-vc141-mt-1_64
#            -llibboost_log_setup-vc141-mt-1_64
#            -llibboost_math_c99-vc141-mt-1_64
#            -llibboost_math_c99f-vc141-mt-1_64
#            -llibboost_math_c99l-vc141-mt-1_64
#            -llibboost_math_tr1-vc141-mt-1_64
#            -llibboost_math_tr1f-vc141-mt-1_64
#            -llibboost_math_tr1l-vc141-mt-1_64
#            -llibboost_mpi-vc141-mt-1_64
#            -llibboost_numpy-vc141-mt-1_64
#            -llibboost_numpy3-vc141-mt-1_64
#            -llibboost_prg_exec_monitor-vc141-mt-1_64
#            -llibboost_program_options-vc141-mt-1_64
#            -llibboost_python-vc141-mt-1_64
#            -llibboost_python3-vc141-mt-1_64
#            -llibboost_random-vc141-mt-1_64
#            -llibboost_regex-vc141-mt-1_64
#            -llibboost_serialization-vc141-mt-1_64
#            -llibboost_signals-vc141-mt-1_64
#            -llibboost_system-vc141-mt-1_64
#            -llibboost_test_exec_monitor-vc141-mt-1_64
#            -llibboost_thread-vc141-mt-1_64
#            -llibboost_timer-vc141-mt-1_64
#            -llibboost_type_erasure-vc141-mt-1_64
#            -llibboost_unit_test_framework-vc141-mt-1_64
#            -llibboost_wave-vc141-mt-1_64
#            -llibboost_wserialization-vc141-mt-1_64
#            -llibboost_zlib-vc141-mt-1_64
#    )





你可能感兴趣的:(cmake教程(一)qt cmake)