cmake

例:

目录

  主程序目录

  demo

    build

    include

      hello.h

    lib

    CMakeLists.txt

    src

      main.cpp

  动态库目录

  helloLib

    build

    CMakeLists.txt

    src

      hello.h

      hello.cpp

demo CMakeLists.txt

cmake_minimum_required(VERSION 3.14)
set(CMAKE_CXX_STANDARD 11)

project(demo)

#头文件
include_directories(${PROJECT_SOURCE_DIR}/include)
#库目录
link_directories(${PROJECT_SOURCE_DIR}/lib)

aux_source_directory(${PROJECT_SOURCE_DIR}/src srcs)
add_executable(demo ${srcs})

#第三方库名
target_link_libraries(demo hello)

helloLib CMakeLists.txt

cmake_minimum_required(VERSION 3.14)
set(CMAKE_CXX_STANDARD 11)

aux_source_directory(${PROJECT_SOURCE_DIR}/src srcs)
add_library(hello SHARED ${srcs})

 minGW 编译的程序在没有装minGW的计算机中需要提供

  libstdc++-6.dll 

  libgcc_s_dw2-1.dll

 

其它包管理工具

https://github.com/xmake-io/xmake/blob/master/README_zh.md

posted on 2019-03-12 10:35  1zfang1  阅读(127)  评论(0编辑  收藏  举报

导航